Jump to content

insert row?


dayp

Recommended Posts

hey ive been having some problems with this code where I try insert a new row of data into a mysql table

 

<?php
$name1=$_POST['name1'];
$dbhost="localhost";
$dbusername="goa";
$dbpassword="jo";
$dbname="goatla";

$connect = mysql_connect($dbhost, $dbusername, $dbpassword);
$s_db = mysql_select_db($dbname,$connect) or die ("Could not select database");

$query = "INSERT INTO `user` ( `name`, `score`) VALUES ( '" . $_POST['name1'] . "' , '"0"');";
$result = @mysql_query($sql) or die ("Query failed");
?>

 

I wanted to add $_POST['name1']  and 0 to the bottom of my table users but it does nothing :( doesnt even add a new row but it goes back no errors. could anyone help me?

Link to comment
https://forums.phpfreaks.com/topic/37593-insert-row/
Share on other sites

sorry but Ive come across another problem

 

from the code above this line

 

$query = "INSERT INTO `here` ( `name`, `score`) VALUES ( '" . $name1 . "' , '0');";

 

I need to put in this variable $school where it says here ive tried a feqw things but none worked anyone have any idea?

Link to comment
https://forums.phpfreaks.com/topic/37593-insert-row/#findComment-179782
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.