How to convert PHP to C++ coding?
Moderator: General Moderators
-
project168
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 26, 2011 1:33 pm
How to convert PHP to C++ coding?
Is there a program which provides this compiling method?
Last edited by project168 on Sun Apr 03, 2011 10:29 am, edited 1 time in total.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: How to use PHP to read/fetch the database's first attrib
Unless CUST_NO is an auto-incrementing field your query may not select the first record. What is your primary key for this table?
Code: Select all
<?php
// selects the record with the lowest primary key value
$query = "SELECT * FROM customer ORDER BY pk_field ASC LIMIT 1";
// to display it
$sql = mysql_query($query);
while ($ary = mysql_fetch_array($sql)) {
echo $ary['CUST_NO'];
echo $ary['CUST_FNAME'];
echo $ary['CUST_LNAME'];
echo $ary['CUST_PHONE'];
}
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
-
project168
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 26, 2011 1:33 pm
Re: How to use PHP to read/fetch the database's first attrib
my primary key is CUST_NO
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: How to use PHP to read/fetch the database's first attrib
So there shouldn't be any problems. Order by primary key ASC and limit by 1, that will give you the first row in the table.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering