Help - no values are being entered in to table

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dweil31
Forum Newbie
Posts: 1
Joined: Fri Aug 05, 2011 4:13 pm

Help - no values are being entered in to table

Post by dweil31 »

I can not get a the data to post to the db table i just can create rows and unique values can anyone help.

Code: Select all

<?php

  // Connect to database
     include_once "scripts/connect_to_mysql.php";


$sql = mysql_query("INSERT INTO membersa (username, password, firstname, lastname, bio_body, city, zip) 
       VALUES(/'$username/',/'$password/',/'$firstname/',/'$lastname/',/'$bio_body/',/'$city/',/'$zip/')") 
       or die (mysql_error());
 
      $id = mysql_insert_id();
	 
	 // Create directory(folder) to hold each user's files(pics, MP3s, etc.)		
     mkdir("members/$id", 0755);
     exit();
      
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="regester.php" method="post" enctype="multipart/form-data">
  <p>
    <label>First Name
      <input type="text" name="firstname" id="firstname" class="formFields" size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>Last Name
      <input type="text" name="lastname" id="lastname" class="formFields" size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>Email
     <input name="email" type="text" class="formFields" id="email"  size="32" maxlength="48" />
    </label>
  </p>
  <p>
    <label>Bio
      <textarea name="bio_body" id="bio_body" cols="45" rows="5"class="formFields"  size="35" maxlength="255" /></textarea>
    </label>
  </p>
  <p>
    <label>City
      <input type="text" name="city" id="city" class="formFields"  size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>Zip Code
      <input type="text" name="zip" id="zip" class="formField size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>User Id
      <input type="text" name="username" id="username" class="formFields"  size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>Password
      <input type="text" name="password" id="password" class="formFields"  size="32" maxlength="20" />
    </label>
  </p>
  <p>
    <label>
       <input type="submit" name="Submit" value="Sign Up!"  />
    </label>
  </p>
 
  <p>&nbsp;</p>
</form>
</body>
</HTML>
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Help - no values are being entered in to table

Post by McInfo »

aliraza
Forum Newbie
Posts: 6
Joined: Sat Oct 08, 2011 2:48 am

Re: Help - no values are being entered in to table

Post by aliraza »

pls give the variables as it is inside query , dont give /'/' ,around variable ,
hope this will insert that record,
normally if there is syntax error,mysql dont allow record to be inserted
Post Reply