Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php script
#1
any php gurus willing to write me a simple php script? sorry, but I'm still a noob in php. =(

I'm trying to basically get a script so that I can enter data, send it to my database then output it into a table to display it. Also and option to delete/edit the rows would be nice, too.

I created a database with the following fields:
date,
price,
year,
condition,
silver,
gold,
weight

maybe have the table output the same data as the fields in my database.

I'm thankful for anyone who is willing to help out.
Reply
#2
I can do that, but until I finsih the script... Please read this tutorial....
http://www.supportforums.net/showthread.php?tid=4506

Edit:
could you give me the SQL query string, that was generated when you created the Table...
Reply
#3
(02-02-2010, 02:10 PM)Master of The Universe Wrote: I can do that, but until I finsih the script... Please read this tutorial....
http://www.supportforums.net/showthread.php?tid=4506

Edit:
could you give me the SQL query string, that was generated when you created the Table...

how do I go back in and get it? I made it like an hour ago.
Reply
#4
Enter the database you have created your Table in, and the at the top press Export... then just OK and you will get a String...

If you still can find it, just tell me what field which type has, like;
date - DATETIME
price - INT and so on...
Reply
#5
(02-02-2010, 02:30 PM)Master of The Universe Wrote: Enter the database you have created your Table in, and the at the top press Export... then just OK and you will get a String...

If you still can find it, just tell me what field which type has, like;
date - DATETIME
price - INT and so on...

-- Table structure for table `coin_info`
--

CREATE TABLE IF NOT EXISTS `coin_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` varchar(100) NOT NULL,
`price` varchar(100) NOT NULL,
`condition` varchar(100) NOT NULL,
`year` varchar(100) NOT NULL,
`silver` varchar(100) NOT NULL,
`gold` varchar(100) NOT NULL,
`weight` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Reply
#6
Here you go, there are 3 files;
coin.php, connect.php and list.php


Read the files and try to understand what they are doing...
If you have any question just ask....

also you can read more here;
http://www.supportforums.net/showthread.php?tid=1609
http://www.supportforums.net/showthread.php?tid=4506
Reply
#7
I hope you protected those against injections...
GamerCraft

Visit it, and tell me what you think. Tongue
Reply
#8
(02-02-2010, 06:11 PM)TheLifelessOne Wrote: I hope you protected those against injections...

A Bit, I will support him, but I won't do the work for him...
Here are tutorials about security..
Reply
#9
thanks for the files. I'm getting this error when trying to access list.php:

Code:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'uglycars'@'localhost' (using password: NO) in /home/uglycars/public_html/andrewshemo/coins/list.php on line 4

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/uglycars/public_html/andrewshemo/coins/list.php on line 4

Warning: mysql_query() [function.mysql-query]: Access denied for user 'uglycars'@'localhost' (using password: NO) in /home/uglycars/public_html/andrewshemo/coins/list.php on line 6

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/uglycars/public_html/andrewshemo/coins/list.php on line 6
SQL Query failed!
Reply
#10
That is because the file was not meant for direct access, it requires a SQL connection...
The file is included at the bottom of coin.php and since the coin.php has established connection it works.
But if you try to access the list.php on it's own it fails, to solve that you put this at the beginning of the list.php

PHP Code:
if(!defined(@$connect)) {
    include 
"connect.php";


It will include the connect.php if $connect wasn't declared.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 956 07-27-2020, 11:26 PM
Last Post: tk-hassan
  Req. Upload PHP script. 3 X P L 0 I T 1 1,355 07-14-2012, 05:19 PM
Last Post: 'Snorlax
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,705 10-10-2011, 01:00 PM
Last Post: Greyersting
  optimize mysql through a php script andrewjs18 7 3,379 10-05-2011, 06:31 PM
Last Post: John.
  Creating a simple PHP/MySQL login script ndee 16 10,530 05-14-2011, 02:18 AM
Last Post: モrainee

Forum Jump:


Users browsing this thread: 12 Guest(s)