Jump to content

Recommended Posts

I have a php file that creats table and is suppost to insert some data into one of the tables it creats the table fine but doesnt insert and it doesnt give an error here is the table and the insert portion, can someone help me here

Thanks

echo '<p>Creating table login';
if(!$result = mysql_query('CREATE TABLE IF NOT Exists login ( userid int(35) NOT NULL auto_increment , user_name varchar(50) NOT NULL , user_pass varchar(255) NOT NULL , user_level varchar(50) NOT NULL , `date` varchar(20) default NULL , user_email varchar(50) NOT NULL  , user_ip varchar(50) NOT NULL , PRIMARY KEY  (userid) )')) { echo ' Error creating Table ' . mysql_error(); }

echo '<p>Inserting admin data into table Login';
mysql_query('INSERT INTO Login VALUES (
"","admin","21232f297a57a5a743894a0e4a801fc3","4","02-19-2009","Admin@bigtop.com","" )');

<?php
echo '<p>Creating table login';
$result = mysql_query('CREATE TABLE IF NOT Exists login ( userid int(35) NOT NULL auto_increment , user_name varchar(50) NOT NULL , user_pass varchar(255) NOT NULL , user_level varchar(50) NOT NULL , `date` varchar(20) default NULL , user_email varchar(50) NOT NULL  , user_ip varchar(50) NOT NULL , PRIMARY KEY  (userid) )') or die(mysql_error());

echo '<p>Inserting admin data into table Login';
mysql_query("INSERT INTO Login VALUES ('','admin','21232f297a57a5a743894a0e4a801fc3','4','02-19-2009','Admin@bigtop.com','' )") or die(mysql_error());

 

A: mysql uses single quotes not double quotes (your query had double quotes.)

 

B: use the die(mysql_error()) to spit out "decent" error messages upon an error (since I take it this is an install script that should be fine.).

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.