Support Forums

Full Version: php script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.
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...
(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.
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...
(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 ;
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
I hope you protected those against injections...
(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..
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!
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.
Pages: 1 2