Jump to content

oriental_express

Members
  • Posts

    113
  • Joined

  • Last visited

    Never

Everything posted by oriental_express

  1. anymore guesses please ? :-X
  2. You have to provide the query with a DESC, or ASC, after ORDER BY $results = mysql_query("SELECT * TABLES SUM(amount) ORDER BY name DESC"); i dont think that is the right select statement to select all tables in database, can anyone help ?
  3. Am not gettin any luck in the mysql part of the forum so maybe i might here. This time im trying to write the correct sql statements to display all the tables names in the database along with the SUM for one of the columns for each table ie 'amount' <?PHP mysql_pconnect('localhost','admin','admin'); mysql_select_db("wml"); $results = mysql_query("SELECT * TABLES SUM(amount) ORDER BY name"); if ($results){ while ($a = mysql_fetch_array($results)) { echo'<TABLE><TR> <TD>'.$fetch['name'].'</TD> <TD>'.$fetch['amount'].'</TD> </TR></TABLE>'; }; print("</TABLE>"); } else { print("No results to display"); }; ?>
  4. one of my tables is blindcare name address ccn expirydate securitycode amount basically my application is a charity application, to donate to using wml Each wml has a form to fill to submit to each table hence 15 different charity to store the info. I cant tink of anyother way to use just one table but also use different forms to record different charity donations. Cananyone else help ? Thank you
  5. hmm might be getting somewhere cause now its giving select COUNT(*) from actiondeafness select COUNT(*) from agedcarersuk select COUNT(*) from agedguildcare select COUNT(*) from agedpillgrimhomes select COUNT(*) from blindcare select COUNT(*) from childhopeuk select COUNT(*) from depaultrust select COUNT(*) from hampshiredeafassociation select COUNT(*) from landheritage select COUNT(*) from manchesterdeafcentre select COUNT(*) from reachfund select COUNT(*) from royalblindsociety select COUNT(*) from vegansociety select COUNT(*) from visionaidoverseas select COUNT(*) from wwf
  6. Arrayselect COUNT(*) from Array Warning: Wrong parameter count for mysql_query() in /home/dontwork/public_html/charity/wml/donations.php on line 16 ??? i really do appreciate you trying ! Im not sure if im understanding correctly but what is it your COUNT(ing) ? As far as i understand " $query = "select COUNT(*) from $a";" means its counting the amount of tables right ? Can you tell me how it would sum up the "amount" colum of each table to display ? thanks
  7. has it got anything to do with attribute names ? name and amount ? cause i know name is not the name of the table but name of the data input.
  8. Array ( [0] => actiondeafness [Tables_in_dontwork_wml] => actiondeafness ) Warning: Wrong parameter count for mysql_query() in /home/dontwork/public_html/charity/wml/donations.php on line 16 lol round in circles. If there anything you need to see in terms of sql database structures and whole of wml file to help ?
  9. i get parse error syntax error , unexpected ';' in /chairty/wml.dontations.php line 16 which is $Q=mysql_query($query)or die(mysql_query(); hmm
  10. says warning: mysql_fetch_array() supplied argumetn is not a valid mysql results reser in /..charity/wml.donations.php on line 16 this is line 16 $fetch = mysql_fetch_array($Q);
  11. it replied me with that mysql warning statement error
  12. could you tell me where you would put that in terms of this mysql_select_db("dontwork_wml"); $results = mysql_query("SELECT * FROM wwf ORDER BY name"); if ($results){ while ($a = mysql_fetch_array($results)) { echo'<TABLE><TR> <TD>'.$a['name'].'</TD> <TD>'.$a['amount'].'</TD> </TR></TABLE>'; }; print("</TABLE>"); } else {
  13. didnt understand the 2nd but the first gives me the idea show tables sum(amount); but doesnt work grrrrrrrr please help
  14. Hi there everyone I have a database with 15 tables in my database format address ccn expirydate securitycode amount I would like to display a table that will name all 15 tables and the sum of amount so eg table 1 456 table 2 465 table 3 987 . . table 15 432 I think it might be like SELECT * TABLES, SUM(amount); ORDER TABLES any ideas ? How would i use php to display it like that I have this already and it doesnt work <?PHP mysql_pconnect('localhost','admin','admin'); mysql_select_db("wml"); $results = mysql_query("SELECT * TABLES, SUM(amount); ORDER TABLES"); if ($results){ while ($a = mysql_fetch_array($results)) { echo'<TABLE><TR> <TD>'.$a['name'].'</TD> <TD>'.$a['amount'].'</TD> </TR></TABLE>'; }; print("</TABLE>"); } else { print("No results to display"); }; ?> any ideas ? thanks guys
  15. woooohooooooooooo I think i solved it by changing it to echo'<TABLE><TR> <TD>'.$a['name'].'</TD> <TD>'.$a['amount'].'</TD> </TR></TABLE>'; by adding table to it so solved for now
  16. yeah i guess. cause right now it should be michael 23 mary 34 joe 33 but its giving michael 23 mary 23 joe 33 I can understand why because that is what the php code says it will do but can anyone add wml tables to it so that i can display it as Name amount michael 23 mary 34 joe 33 thank you
  17. ive manged to get the simulator to display records but they are being displayed wrong . My desired format is Name Amount xxxxxxx xxxxxxx but its giving xxxxxx xxxxxx xxxxxx xxxxxx I know im missing some wml code , could someone point me in the right direction <?PHP mysql_pconnect('localhost','admin','admin'); mysql_select_db("wml"); $results = mysql_query("SELECT * FROM wwf, ORDER BY name"); if ($results){ while ($a = mysql_fetch_array($results)) { echo'<TR> <TD>'.$a['name'].'</TD> <TD>'.$a['amount'].'</TD> </TR>'; }; print("</TABLE>"); } else { print("No results to display"); }; ?>
  18. can you give me some sort of search term please ? thanks
  19. Hi there eveyone im having abit of a problem Im not sure if its correct to have php embedded into wml or just better to use php to display records. Any how this is not working for some reason. Any ideas that could help ? Thanks <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="page1" title="Total donations"> <p> <table columns="3" align="LCR"> <tr> <td>Name</td> <td>Amount donated</td> </tr> </table> <br/><br/> </p> <?PHP mysql_pconnect('localhost','admin','admin'); mysql_select_db("wml"); $results = mysql_query("SELECT * FROM wwf ORDER BY name"); if ($results){ while ($a = mysql_fetch_array($results)) { echo'<TR> <TD>'.$a['name'].'</TD> <TD>'.$a['amount'].'</TD> </TR>'; }; print("</TABLE>"); } else { print("No results to display"); }; ?> <p> <a href="menu.wml#main">Main menu</a> </p> </card> </wml>
  20. Thank you so much ! phpsensei im ever so greatful !
  21. wierd problems Now i have " you have an erro in your sql syntax; check the manual that coressponds to the mysql server version for the right syntax to use near " at line 1 ??? Thanks for your help by the way. Any other ideas ?
  22. //Create SQL string $insert = "INSERT INTO $table_name (name,address,ccn,expirydate,securitycode,amount) VALUES ('$name','$address','$ccn','$expirydate','$securitycode','$amount'"; mysql_query($insert) or die ("Could not add data to the table"); echo "Your donation has been successfully recieved"; that bit exactly.
  23. no luck cause it now says could not add data to the table
  24. it nows says cannot make connection
  25. Hi there everyone, im kinda having trouble getting my application to store data, my problem is that it seems to connect to mysql but then it says " ("Could not add data to the table"); " Im using this wml deck <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="aged" title="Aged Charites"> <p align="center">Select charity to donate </p> <p> <select> <option title="Pilgrim Homes" onpick="#pilgrimhomes">Pilgrim Homes</option> <option title="Guild Care" onpick="#guildcare">Guild Care</option> <option title="Carers UK" onpick="#carersuk">Carers UK</option> <br/><br/> </p> <p> <a href="menu.wml#main">Main menu</a> </p> </card> <card id="pilgrimhomes" title="Pilgrim Homes"> <p>We have been looking after needy, elderly Christians since 1807.<br/></p> <p align="center"><b>Form<b/></p> <p> Name: <input name="name" size="15"/> Adddress: <input name="address" size="15"/> Credit card no: <input name="ccn" size="15"/> Expiry date mm/yy: <input name="expirydate" size="15"/> Security code: <input name="securitycode" size="15"/> Amount to donate: <input name="amount" size="15"/> <anchor> <go method="post" href="agedpillgrimhomes.php"> <postfield name="name" value="$(name)"/> <postfield name="address" value="$(address)"/> <postfield name="ccn" value="$(ccn)"/> <postfield name="expirydate" value="$(expirydate)"/> <postfield name="securitycode" value="$(securitycode)"/> <postfield name="amount" value="$(amount)"/> </go> Submit </anchor> </p> <p> <a href="menu.wml#main">Main menu</a> </p> </wml> and this is my php code to store the data but its not working <?php header('Content-type: text/vnd.wap.wml'); ?> <?php echo '<?xml version="1.0"?'.'>'; ?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <?php #this script stores form entry data as before but will validate for empty fields # and check for a duplicate record of the book, in either case an error message # will be displayed in the client import_request_variables("P", "mypost_"); /* Get the posted book form's values from the request object*/ $name = $mypost_name; $address = $mypost_address; $ccn = $mypost_ccn; $expirydate = $mypost_expirydate; $securitycode = $mypost_securitycode; $amount = $mypost_amount; if (empty($name) || empty($address) || empty($ccn) || empty($expirydate) || empty($securitycode) || empty($amount)) { echo "Please go back and fill in all the fields"; } else { //db connection - Note how the next few lines have moved away from the book data storage SQL $connection = @mysql_pconnect("localhost", "admin", "admin") or die("cannot make connection"); /* Set up database and table names */ $db_name = "wml"; $table_name = "agedpillgrimhomes"; //Open db connection $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $query = "SELECT name FROM $table_name WHERE name ='$name'"; $result = mysql_query($query, $connection); $numrows = mysql_num_rows($result); if ($numrows == "0") { //No match - book is unique //Create SQL string $insert = "INSERT INTO $table_name (name,address,ccn,expirydate,securitycode,amount) VALUES ('$name','$address','$ccn','$expirydate','$securitycode','$amount'"; mysql_query($insert) or die ("Could not add data to the table"); echo "Your donation has been successfully recieved"; } else { //The book has been entered on a previous occasion echo "Your donation was not accepted this time"; exit(); } } ?> ive created a database via mysql but does not work cause the record wont insert. Ive made sure the phone simulator is in good order but still no luck. Can anyone help please Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.