Hello,
I’m currently testing a script (Update multiple rows in mysql form) which i found on a website, but I can’t get to work.
It shows the form perfectly, but I want to be able to update the values (as it’s supposed to with this script)
When I press “Submit” the old values pops back on the form.
Any ideas what could be wrong with this script?
SQL
[code]CREATE TABLE test_mysql
(
id
int(4) NOT NULL auto_increment,
name
varchar(65) NOT NULL default ‘’,
lastname
varchar(65) NOT NULL default ‘’,
email
varchar(65) NOT NULL default ‘’,
PRIMARY KEY (id
)
) TYPE=MyISAM AUTO_INCREMENT=7 ;
– Dumping data for table test_mysql
INSERT INTO test_mysql
VALUES (1, ‘Billly’, ‘Blueton’, ‘[email protected]’);
INSERT INTO test_mysql
VALUES (2, ‘Jame’, ‘Campbell’, ‘[email protected]’);
INSERT INTO test_mysql
VALUES (3, ‘Mark’, ‘Jackson’, ‘[email protected]’);
INSERT INTO test_mysql
VALUES (4, ‘Linda’, ‘Travor’, ‘[email protected]’);
INSERT INTO test_mysql
VALUES (5, ‘Joey’, ‘Ford’, ‘[email protected]’);
INSERT INTO test_mysql
VALUES (6, ‘Sidney’, ‘Gibson’, ‘[email protected]’);[/code]
PHP
[php]<?php
$host=“localhost”; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=“test”; // Database name
$tbl_name=“test_mysql”; // Table name
// Connect to server and select databse.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);
$sql=“SELECT * FROM $tbl_name”;
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
?>
|
Thanks alot in advance!
Robert