If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > A very minor problem but doesn't seen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-30-10, 17:24
don_log don_log is offline
Registered User
 
Join Date: Jun 2008
Location: pakistan
Posts: 109
A very minor problem but doesn't seen

i have a very serious problem with this i make a form
and i have a table called std_info
there is 3 records with the stnd_id column name
11
12
13

these are the records
PHP Code:
$quer1="select max(stnd_code) from std_info";

$quexe=mysql_query($quer1);

while(
$row=mysql_fetch_assoc($quexe)){
                             
$plus=$row['stnd_code'];

echo 
$plus+1;

i need that it increase 1 after max id but it returns only 1

nothing increament and no max id selection please help that
Reply With Quote
  #2 (permalink)  
Old 05-30-10, 20:19
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,538
$quer1="SELECT MAX(stnd_code) AS max_code FROM std_info";

$plus=$row['max_code'];
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-31-10, 02:04
don_log don_log is offline
Registered User
 
Join Date: Jun 2008
Location: pakistan
Posts: 109
Thanks and another one problem is that whenever i insert phone number here it doesn't insert phone contact to here

the structures are as follow
PHP Code:
$student_code=$_POST['std_code'];
$family_code=$_POST['std_fcode'];
$student_name=$_POST['std_name'];
$student_fname=$_POST['std_fname'];
$student_fnic=$_POST['std_fnic'];
$student_mname=$_POST['std_mname'];
$student_mnic=$_POST['std_mnic'];
$student_address=$_POST['std_add'];
$student_dobd=$_POST['std_dobd'];
$student_dobm=$_POST['std_dobm'];
$student_doby=$_POST['std_doby'];
$student_gender=$_POST['std_gen'];
$student_phone=$_POST['std_ph'];
$student_mobile=$_POST['std_mob'];
$student_jdate=$_POST['std_jdate'];
$student_fees=$_POST['std_fee'];
$student_class=$_POST['std_class'];
$student_dob=$student_doby."-".$student_dobm."-".$student_dobd;
$sql="insert into std_info values('$student_code','$family_code','$student_name','$student_fname','$student_fnic','$student_mname','$student_mnic','$student_address','$student_dob','$student_gender','$student_phone','$student_mobile','$student_jdate','$student_fees','$student_class')";
$query=mysql_query($sql);
if(!
$query){
    echo 
"Query doesn't Executed Re-register Student";
}
else
{
    echo 
"Student Register Successfully ";

it register student succesfully but doesn't insert phone number just only insert 0

tell me what problem is that and the table structure is as follow

PHP Code:
CREATE TABLE std_info(stnd_code intstnd_fcode intstnd_name varchar50 NOT NULL stnd_fname varchar50 NOT NULL stnd_fnic varchar25 ) , stnd_mname varchar50 NOT NULL stnd_mnic varchar25 ) , stnd_add varchar100 NOT NULL stnd_dob datestnd_gender varcharNOT NULL stnd_ph intstnd_mob intstnd_jdate datestnd_fees int stnd_class varchar(10NOT NULL 
Reply With Quote
  #4 (permalink)  
Old 06-01-10, 07:15
saviola saviola is offline
Registered User
 
Join Date: Jun 2010
Posts: 6
Querys seem correctly.
Check whether you wrote wrong name of the field in the array POST and whether $student_phone contain the value wich is posted in phone field in form.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On