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? 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 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() 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"); ?> 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: "; ?> 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. 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) Link to comment https://forums.phpfreaks.com/topic/46209-solved-hello/#findComment-224663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.