Jump to content


Photo

Not sure if its an SQL problem or PHP


  • Please log in to reply
3 replies to this topic

#1 Dark-Hawk

Dark-Hawk
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 25 May 2003 - 03:41 PM

Alright so I have a script that i have made to manage a store.. It\'s reading fine from the DB, but not writing to it for some reason, I am pretty posative nothing is wrong with the PHP, if you wanna check that out go to www.liquiddesignz.com/str.phps .. the SQL I used is:

CREATE TABLE store (
id tinyint(4) NOT NULL auto_increment,
datetime varchar(100) NOT NULL default \'\',
name varchar(16) NOT NULL default \'\',
price varchar(32) NOT NULL default \'\',
descsmall tinyint(150) NOT NULL default \'\',
desclarge varchar(200) NOT NULL default \'0\',
sec tinyint(10) NOT NULL default \'0\',
PRIMARY KEY (id),
KEY id (id)
) TYPE=MyISAM;

This is really startin to agrivate me lol, thanks alot for any help

- Dh

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 26 May 2003 - 12:45 PM

$insert = "INSERT INTO store(name, price, descsmall, desclarge, date, id) VALUES(\'$name\', \'$price\', \'$descsmall\', \'$desclarge\', \'$date\', \'$id\')";

        

$mysql_insert = mysql_query($insert)

            or die("Error! Unable to connect to the database!");


$mysql_link ->>> Were is this declared u can leave it blacnk as it will poin to the default open connection


Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 Dark-Hawk

Dark-Hawk
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 26 May 2003 - 09:03 PM

That is defined within the config file, guess I should have shown that as well, my bad, but here is the config file:


<?php

// - Login MySql -

$server = "localhost";

$sqluser = "****";

$sqlpass = "****";

$db = "ecom";



$mysql_link = mysql_pconnect("$server", "$sqluser", "$sqlpass")

               or die("Unable to connect to MySQL server");

mysql_select_db("$db") or die( "It\'s connecting to the MySQL server, but unable to select database");

?>



#4 Dark-Hawk

Dark-Hawk
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 29 May 2003 - 02:05 PM

Alright well I got the problem fixed, thanks alot for the help..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users