03142005 0951 GMT-6
Ok.
if( isset ( $_POST['Register'] ) ) {
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$registerdate = $_POST['registerdate'];
$db_name = "test";
$connection = mysql_connect("localhost", 'user", "pass") or
die("Connection error: <br />" . mysql_error() );
$db = mysql_select_db($db_name, $connection) or die("db
select error: <br />" . mysql_error() );
$sql = "INSERT INTO test (firstname, username, registerdate,
password, lastname ) VALUES (";
$sql = " ' " . $firstname . " ' , " ;
$sql.= " ' " . $lastname . " ' , " ;
$sql.= " ' " . $username . " ' , " ;
$sql.= " ' " . $password . " ' , " ;
$sql.= " ' " . $registerdate . " ' ) " ;
$result = mysql_query($sql);
echo "<pre>";
print_r($result);
-->
Checking the mysql server I found the col names to be this:
firstname, username, userid, accessdate, registerdate, password,
lastname
And only firstname and lastname had values.
I then changed the sql insert to this:
$sql = " ' " . $firstname . " ' , " ;
$sql.= " ' " . $username . " ' , " ;
$sql.= " ' " . $registerdate . " ' , " ;
$sql.= " ' " . $password . " ' , " ;
$sql.= " ' " . $lastname . " ' ) " ;
The userid is auto incrementing and accessdate is a timestamp.
This arrangement didnt do anything. When doing print_r($result) there is
nothing echoed.
I havent run into this problem before. Is it first in type thing?
Wade
Pete wrote:
>In message <[EMAIL PROTECTED]>, Wade <[EMAIL PROTECTED]>
>writes
>
>
>
>>I created a database with MySQL Control Center. Then I created my php
>>scripts. When I went to insert values from the script only two values
>>went in: the first two values, in order, in the script. When I checked
>>the db I found that the columns are now out of order.
>>
>>
>
>I think that we would need to see a little of your script. If you have
>a lot of inserts, just include the first two or three.
>
>
>
[Non-text portions of this message have been removed]
The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/