| | |
Retreiving variables from a sql query into a form
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2004
Posts: 6
Reputation:
Solved Threads: 0
I need to add a paypal 'add to cart' button to my page to submit the contents of my table to a shopping cart. The contents of the table are variables as they are from a sql query. Does anyone know hoe I could get the paypal link(script below) to retreive the variables from my query and submit them to the shopping cart.
I need $myrow[0] to be used for item_number, $myrow[1],$myrow[2],$myrow[3] and $myrow[4] to be combined to make item_name and $myrow[5] to be used for Ammount.
Thanks
Huw
PHP Syntax (Toggle Plain Text)
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> <input type="hidden" name="add" value="1"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="info@wildcar.co.uk"> <input type="hidden" name="item_name" value=""> <input type="hidden" name="item_number" value=""> <input type="hidden" name="amount" value=""> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="GBP"> </form>
I need $myrow[0] to be used for item_number, $myrow[1],$myrow[2],$myrow[3] and $myrow[4] to be combined to make item_name and $myrow[5] to be used for Ammount.
Thanks
Huw
can you provide more specifics on sql versions, platform, etc?
My Home Away from Home: Yet Another Linux Blog
You could run a query like:
[php]<?php
// don't forget to create a connection to database first!
// i.e.:
@mysql_connect('localhost','username','password');
// and choose a database
@mysql_select_db('database_name');
// fetch the info from database
$myrow = @mysql_query("SELECT * FROM table");
// make it so that it's like $myrow[0], $myrow[1], etc.
$myrow = mysql_fetch_row($myrow);
?>[/php]
[php]<?php
// don't forget to create a connection to database first!
// i.e.:
@mysql_connect('localhost','username','password');
// and choose a database
@mysql_select_db('database_name');
// fetch the info from database
$myrow = @mysql_query("SELECT * FROM table");
// make it so that it's like $myrow[0], $myrow[1], etc.
$myrow = mysql_fetch_row($myrow);
?>[/php]
![]() |
Similar Threads
- simple sql query (PHP)
- Help in using SQL Query in Crstal report with VB.NET (VB.NET)
- Creating Table using SQL query from wondows Form (VB.NET)
- retrieving a particular value with a sql query (PHP)
- C# VS 2005 - SQL Query Parameters to an ODBC DataSource (C#)
- sql query updating problem (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: Which template is it? [vbulletin]
- Next Thread: need help with PHP Script translation
| Thread Tools | Search this Thread |
apache api array basic binary body broken cakephp class cms code computing confirm cron curl customizableitems database date date/time delete dynamic ebooks email error file filter folder form forms forum function functions gc_maxlifetime header headmethod href htaccess html iframe image include ip javascript joomla limit link list login malfunction mediawiki memmory memory menu msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter parsing paypal pdf php phpincludeissue query question random recourse regex script search seo server sessions snippet source sp space speed sql static subdomain system table tag thesishelp trouble tutorial update upload url variable vbulletin web webdesign white xml youtube





