Jump to content

Sobbs

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by Sobbs

  1. Never mind, i figure this out by trial and error.
  2. Ive tried to find a tutorial on this, but non worked the way i needed it to.
  3. How would I get a single variable from that though? Like lets say I want to get info from a single row, such as a username.
  4. Im trying to connect to a database table and retrieve about 10 rows of data and turn those into variables to be viwed on a site. Ive attempted this but cannot figure out how I'd manage to do this. It would be somewhat like how a forum would display database info. Could someone help?
  5. What do you mean by that?
  6. Those do work. I tried running my code on another server and I had the same results. No errors, and nothing added.
  7. Ive done that, however, im still seing no error messages. <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $con = mysql_connect("sql312.byethost33.com","b33_3176976","n00b1234"); if (!$con) { die('Could not connect: ' . mysql_error()); }else{ echo "Connected to DB"; } $db = mysql_select_db("b33_3176976_lunadb", $con); if (!$db) { die('Could not connect: ' . mysql_error()); }else{ echo "DB selected"; } if (!mysql_query("INSERT INTO `DB_Guide` (`gid`, `uname`, `gname`, `icon`, `dsc`, `cat`, `body`, `score`) VALUES (NULL, 'test', 'test', 'test', 'test', '1', 'test', '0')")) { echo mysql_error(); } else { echo "success"; } ?>
  8. If you looked at my updated code, I did change it.
  9. None. if (!mysql_query("INSERT INTO DB_Guide (uname, gname, icon, dsc, cat, body, score) VALUES ('test', 'test', 'test', 'test', '1', 'test', '0')")) { echo mysql_error(); } else { echo "success"; }
  10. Im not getting any errors showing up. It apears to be running properly, but nothing is added into the database.
  11. Its still not working. if (!mysql_query("INSERT INTO DB_Guide (uname, gname, icon, dsc, cat, body, score) VALUES ('test', 'test', 'test', '1', 'test', '0')")) { echo mysql_error(); } ?>
  12. I added that and its still not enetering anything into the database. Ive re written the code without any post data. <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $con = mysql_connect("--","--","--"); if (!$con) { die('Could not connect: ' . mysql_error()); }else{ echo "Connected to DB"; } $db = mysql_select_db("b33_3176976_lunadb", $con); if (!$db) { die('Could not connect: ' . mysql_error()); }else{ echo "DB selected"; } mysql_query("INSERT INTO DB_Guide (uname, gname, icon, desc, cat, body, score) VALUES ('test', 'test', 'test', 'test', 'test', '0')"); ?> It still doesn apear to work.
  13. That pretty much is the entire code. There isn't much to it. Its simply ment to add info from a form into a database
  14. Im unable to enable error reporting for some reason. And it was in response to irkevin's attempt.
  15. How would I turn it on?
  16. $con = mysql_connect("xxxxxxxxxxx","xxxxxxxx","xxxxxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); }else{ echo "Connected to DB"; } $sql = "INSERT INTO `b33_3176976_lunadb`.`DB_Guides` (`gid`, `uname`, `gname`, `icon`, `desc`, `cat`, `body`, `score`) VALUES (NULL, \'$_POST['name']\', \'$_POST['guidename']\', \'$_POST['icon']\', \'$_POST['description']\', \'$_POST['cat']\', \'$_POST['body']\', \'0\');"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); This is supposed to add the info requested from a form but for somereason non of the info ever gets put into the database. The code doesnt even seem to work since it should say I was connected to the database but I always get a blank screen. Whats going wrong?
×
×
  • 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.