473,378 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to use parameters in sql ?(PHP)

18
I want to write this sql query:

Expand|Select|Wrap|Line Numbers
  1. Select * from table1 limit 0,5
when i wanted to use php parameter for this query, i got syntax error.

My code:

[PHP]...
$count = 0;
...
mysql_query("Select * from table1 limit".$count.",5");[/PHP]

So how can i fix the syntax problem for using the parameter in sql?
Aug 1 '07 #1
8 1493
ak1dnar
1,584 Expert 1GB
Hi There!
Welcome to TSDN!

Try This

[PHP] mysql_query("Select * from table1 limit $count,5");[/PHP]

Or

[PHP] mysql_query("Select * from table1 limit {$count},5");[/PHP]
Aug 1 '07 #2
afraze
18
Thanks so much for your interest!. . .
Aug 1 '07 #3
ak1dnar
1,584 Expert 1GB
Thanks so much for your interest!. . .
So does it works afraze?
Aug 1 '07 #4
afraze
18
ajaxrand,

i am not using my personal comp.. So i 'll answer u after a couple of hours.. nearly 22:00 (my pos: gmt + 2)

see u later
Aug 1 '07 #5
afraze
18
ajaxrand,

Your code doesn't work . . .

i have still syntax problem.. :(
Aug 1 '07 #6
realin
254 100+
ajaxrand,

Your code doesn't work . . .

i have still syntax problem.. :(
the code is perfect, it should work.. paste the error ;)

that would help us
Aug 1 '07 #7
afraze
18
Ajaxrand,
i fixed my problem. Yes your code is perfect. i had a character problem. So thnks again..
Aug 1 '07 #8
ak1dnar
1,584 Expert 1GB
Ajaxrand,
i fixed my problem. Yes your code is perfect. i had a character problem. So thnks again..
Ahha, Glad to hear that.
post back any time if you have any doubts!

-Ajaxrand
Aug 2 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Miles Davenport | last post by:
Apologies for cross-posting, but I felt this query would be relevant to HTML and PHP forums. I am currently modifying a PHP IMAP script which allows the user to view their email via a web...
4
by: JD | last post by:
I want to pass two parameters to a simple script running on my web server. The script "parpass.php" looks like this: <?php echo "The total number of parameters passed was: $argc \n"; echo...
1
by: JD | last post by:
I posted this earlier and it disappeared from the NewsGroup I want to pass two parameters to a simple script running on my web server. The script "parpass.php" looks like this: <?php echo...
2
by: Joe Lui | last post by:
Hello everyone, I am new to PHP and web server in general so please bear with me if it's an obvious mistake. My problem is that parameters entered in URL do not update php variables. I am...
3
by: aa | last post by:
If I pass parameters to a PHP script in URL like ..php?a=aa&b=bb how do I recover them on the receiving PHP end? I looked at the list of PHP Variables using phpinfo() and found nothing suitable
3
by: zimba | last post by:
Hello, Do you know a better way to : - instanciate a class with an unknown number of parameters in the constructor - call an object's method, also with an unknown number of parameters ? ...
3
by: DCB | last post by:
Hello. I have an easy question, likely, that has me in a headspin. I have an include file to a frames based site that basically forces frames on the end user if they visit the site and hit a...
6
by: Eric Johnston | last post by:
I want the visitor to enter three numbers on the page and then click a button "generate image" which will I hope cause a generated gif image to be displayed alongside on the page. This involved...
0
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a...
1
by: kerriejones | last post by:
I currently have a php page, and need to pass parameters from here into ASP.Net session variables. Can someone please help. My ASP parameters are constantly blank PHP: <script> function...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.