jakebur01 Posted April 9, 2007 Share Posted April 9, 2007 I got some code that had the function db_connect and I had to change it to mysql_connect for in to work. I am having trouble with db_insert, what would be another function that would replace this? Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/ Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 well without seeing the code let take a random guess (as thats all i can work with) erm... mysql_insert Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224652 Share on other sites More sharing options...
jakebur01 Posted April 9, 2007 Author Share Posted April 9, 2007 mysql_connect("localhost","myuser","mypass"); mysql_select_db("mydatabase"); $now = strtotime(date("Y/m/d H:i:s")); $expire = $now + (60 * 60 * 24 * 30); $values = "'$username','$first','$last','$pass',1,'$now','$expire'"; $cols = "username,first,last,password,billing,created,expire"; $id = db_insert ("users", $cols, $values); mysql_close(); echo "<br><br> Account #$id Created"; $_SESSION ["cur_user"] = $id; echo "<Br><Br>Saving contact Info Record Number: "; I tried mysql_insert, i get :Call to undefined function mysql_insert() Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224655 Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 was their a file included before if not your need to add the SQL Statements yourself ie <?php $query = "INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)"; $result = @mysql_query($query, $id) or MySQL_ErrorMsg ("Unable to perform query: $query"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224657 Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 here <?php $id =mysql_connect("localhost","myuser","mypass"); mysql_select_db("mydatabase"); $now = strtotime(date("Y/m/d H:i:s")); $expire = $now + (60 * 60 * 24 * 30); $tablename = ""; // <-- i don't know what the table name is $values = "'$username','$first','$last','$pass',1,'$now','$expire'"; $cols = "username,first,last,password,billing,created,expire"; //$id = db_insert ("users", $cols, $values); // <--Removed $query = "INSERT INTO $tablename ($cols) VALUES ($values)"; $result = @mysql_query($query, $id) or MySQL_ErrorMsg ("Unable to perform query: $query"); mysql_close(); echo "<br><br> Account #$id Created"; $_SESSION ["cur_user"] = $id; echo "<Br><Br>Saving contact Info Record Number: "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224658 Share on other sites More sharing options...
jakebur01 Posted April 9, 2007 Author Share Posted April 9, 2007 thank you soo much man. Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224659 Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 Welcome Can you click solved please (botton left) Quote Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.