Jump to content

pietbez

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by pietbez

  1. can someone please point out where i m going wrong. this code is working fine, but i need the results in a variable $result = mysql_query("SELECT * FROM `gifts` WHERE `id` =$id "); while($row = mysql_fetch_array($result)) { echo $row['price'] , $row['units']; } so, when i do this, i only get the first variable??? $result = mysql_query("SELECT * FROM `gifts` WHERE `id` =$id "); while($row = mysql_fetch_array($result)) $price = $row['price']; $units = $row['units']; { echo $price , $units; } please help.
  2. sorry for that. that was a stupid mistake. cant believe i didnt pick that up. sometimes when you stare at the code to long you start missing things. thanks for that.
  3. here is the form with the radio buttons thanks <?php $id = $_REQUEST['id']; $guest = $_REQUEST['guest']; ?> <html> <head> <title>RSVP</title> <link rel='stylesheet' type='text/css' href='style.css' /> </head> <body style="body"> <ul id="nav"> <li><a href="home.php?id=<?php echo $id; ?>&guest=<?php echo $guest; ?>">invitation</a></li> <li><a href="rsvp.php?id=<?php echo $id; ?>&guest=<?php echo $guest; ?>">rsvp</a></li> <li><a href="menu.php?id=<?php echo $id; ?>&guest=<?php echo $guest; ?>">menu</a></li> <li><a href="sleep.php?id=<?php echo $id; ?>&guest=<?php echo $guest; ?>">sleep</a></li> <li><a href="gifts.php?id=<?php echo $id; ?>&guest=<?php echo $guest; ?>">gifts</a></li> </ul> <div id="rsvp-wrap"> <h2><?php echo $guest; ?></h2> <h2>Will you be joining us on our special day?</h2> <form method="post" action="rsvp_update.php"> <table> <input type="hidden" name="guest" value="<?php echo $guest; ?>"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="radio" name="attend" value="Yes"/>- Yes yes yes! cant wait<br><br> <input type="radio" name="attend" value="Maybe"/>- Too early to say, gotta check my diary. but pencil me in<br><br> <input type="radio" name="attend" value="sorry"/>- Would love to be there, but wont be able to make it. Let me buy you a present to make up for it<br><br> <input type="radio" name="attend" value="No"/>- No. not gonna bother. never realy liked you guys that much anyway<br><br><br> <input type="Submit" value="Submit" /> </table> </form> </div> </body> </html>
  4. pulling my hair out here, please help. why am i getting a "maybe!" result no matter what my radio box selection is. i know the variable gets passed to this php succesfully, i tested it with "echo $attend" then i get the right results but when i use this code, my result is always "maybe" Please hepl <?php $guest = $_REQUEST['guest']; $attend = $_REQUEST['attend']; $id = $_REQUEST['id']; include('include/connection.php'); $query="UPDATE data SET guest = '$guest', attend = '$attend' WHERE id = '$id'"; mysql_query($query) or die ('Error updating database'); if ($attend == "yes") { echo "yes!"; } else if ($attend == "no") { echo "no!"; } else { echo "maybe!"; } ?>
  5. Hi, i know this is probably very basic but i have been banging my head and looking for tuts. i have built a mysql php dropdown menu. all displays fine. now, how do i get the menu to actualy take me to a new url? the new url should be www.mysite.com/"menu selection" <? include_once 'includes/db.php'; $result = mysql_query("select * from crimerate WHERE DISTRICT = 'Limpopo'", $con); if (!$result) { die('Invalid query: ' . mysql_error()); } $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $crime=$row["CRIME"]; $options.="<OPTION VALUE=\"$id\">$crime</option>"; } ?> <SELECT NAME=crime> <OPTION VALUE=0>Choose <?=$options?> </SELECT>
  6. thank you so much, that is exactly what i was looking for you saved me alot of pain
  7. Hi, can anybody please tell me how i can make "Arson" into a php variable <script type="text/javascript" src="js/swfobject.js"></script> <script type="text/javascript"> swfobject.embedSWF( "open-flash-chart.swf", "my_chart", "550", "400", "9.0.0", "expressInstall.swf", {"data-file":"ofc-chart.php?crime=Arson"} ); </script>
  8. thanks, its perfect, slowly i learn
  9. no, thanks, its working fine, it was just in responce to your question about <span> the first link in the menu is active by default <li id="current"><a href="#"><span><?php echo $but1['title'];?></span></a></li> <li><a href="#"><span><?php echo $but2['title'];?></span></a></li> <li><a href="#"><span><?php echo $but3['title'];?></span></a></li> <li><a href="#"><span><?php echo $but4['title'];?></span></a></li> does that have anything to do with <span>?
  10. oops sorry, <li id="current"><a href="#"><span><?php echo $but1['title'];?></span></a></li> <li><a href="#"><span><?php echo $but2['title'];?></span></a></li> <li><a href="#"><span><?php echo $but3['title'];?></span></a></li> <li><a href="#"><span><?php echo $but4['title'];?></span></a></li> http://76.162.122.173/mygreenclean/index.php here you can see what im atempting to do
  11. i know this might sound like a stupid question to all you pros, but to me this is a mountain ??? what would be the sensible way to code this? <?php include('qazwsxedc/config.php'); mysql_connect($server,$username,$password); @mysql_select_db($database) or die ("Unable to connect to the database"); $button1 = mysql_query("SELECT title FROM menu where id=1"); $but1 = mysql_fetch_array( $button1 ); $button2 = mysql_query("SELECT title FROM menu where id=2"); $but2 = mysql_fetch_array( $button2 ); $button3 = mysql_query("SELECT title FROM menu where id=3"); $but3 = mysql_fetch_array( $button3 ); $button4 = mysql_query("SELECT title FROM menu where id=4"); $but4 = mysql_fetch_array( $button4 ); ?> <li><a href="#"><span><?php echo $but1['title'];?></span></a></li> <li><a href="#"><span><?php echo $but2['title'];?></span></a></li> <li><a href="#"><span><?php echo $but3['title'];?></span></a></li> <li><a href="#"><span><?php echo $but4['title'];?></span></a></li>
  12. i tried this, but no luck. still getting the same results. any other ideas?
  13. yes, thanks for all the help. my php and flash is now getting along like a house on fire (with a few modifications from my side .)
  14. im sorry if you feel my post does not belong here, but i am keen to learn php. all my background is flash actionscript. and yes i did try to modify it for my needs. you have to remember, what looks obvious to an expert can be a mountain for a noob
  15. wow! finaly! success! i have a populated table. thanks to everyone who helped. but now i have one more problem. i dont need the output in table form. i am sending this data to a flash file and the flash needs the data in an aray. this format to be precise. &song_title=song1|song2|song3|&artist=artist1|artist2|artist3|&year=2001|2002|2003| i know i am a pain in thr arse!
  16. OK, to sum up. i will show various examples of code that people have suggested. but unfortunatly all with similar results. No1 <?php include("../inc/db.inc.php"); $query = mysql_query("SELECT * FROM favourite WHERE user_name = 'jojo'"); while($row = mysql_fetch_row($query)) { $songInfo = mysql_query("SELECT * FROM songs WHERE song_id = '{$row['song_id']}'"); $songInfo = mysql_fetch_row($songInfo); echo $songInfo["song_title"] ." / ". $songInfo["artist"] ." / ". $songInfo["year"] ."\n"; } ?> and this is the output i get: / / / / / / / / / / No2. <?php include("../inc/db.inc.php"); $query = mysql_query("SELECT favourite.user_name, songs.song_title, songs.artist, songs.year FROM songs,favourite WHERE songs.song_id=favourite.song_id AND favourite.user_name='jojo' "); while($row = mysql_fetch_row($query)) { $song_title.=$row["song_title"].'|'; $artist.=$row["artis"].'|'; $year.=$row["year"].'|'; } echo "&song_title=".$song_title."&artist=".$artist."&year=".$year; ?> and this is the output i get: &song_title=|||||&artist=|||||&year=||||| No3. <?php include("../inc/db.inc.php"); $query = mysql_query("SELECT * FROM favourite JOIN songs USING (song_id) WHERE user_name = '$user_name'"); while($row = mysql_fetch_row($query)) { $song_title.=$row["song_title"].'|'; $artist.=$row["artist"].'|'; $year.=$row["year"].'|'; } echo "&song_title=".$id."&artist=".$name."&year=".$votes; ?> and this is the output i get: &song_title=&artist=&year= any ideas?
  17. Any one know where i can get a small and simple, realtime currency converter. either php or even flash/php. oh yeah, FREE if pos
  18. how can i change the name of the uploaded file by adding a variable to the name. for example. picture.jpg becomes 1_ picture.jpg <?php move_uploaded_file($_FILES['Filedata']['tmp_name'], "./links/".$_FILES['Filedata']['name']); chmod("./links/".$_FILES['Filedata']['name'], 0777); ?>
  19. and here is what i get this time. SONG ID Username as if my fields are empty. but they are not. i think im starting to go mental! i know it must be a small thing
  20. $query = mysql_query("SELECT favourite.user_name, songs.song_title, songs.artist, songs.year FROM songs,favourite WHERE songs.song_id=favourite.song_id AND favourite.user_name='jojo' "); while($row = mysql_fetch_row($query)) { $Song_title.=$row["Song_title"].'|'; $artist.=$row["artis"].'|'; $year.=$row["year"].'|'; } echo "&Song_title=".$Song_title."&artist=".$artist."&year=".$year; ?> and this gives me &Song_title=|||||&artist=|||||&year=|||||
  21. i need some help with a mysql query i know this should be quite simple but its to much for my little brain. one table holds song information like: table name=songs: song_id, song_title, artist, year. one table holds user favourites like: table name=favourites: user_name, song_id so by making the user_name available to php, i want to be able to list that user's favourite songs plus song title artis and year. so if i give the php a variable of the user name: jojo, the output should be the wall / pink floyd / 1978 satisfaction / the stones / 1974 hey jude / the beatles / 1976 please can some one help me out here
  22. ok, i have figgured something out. my flash file calls this php in order to populate my flash file with pictures. it looks like it is this php that messes with the links on main page. could that be possible? if i remove the echo from this php file everything works fine, appart ofcource the flash file that does not get populated with pictures $category=intval($_POST['category']); $do=mysql_query ("SELECT * FROM items WHERE category = $category ORDER by votes DESC" ); $x=mysql_num_rows($do); if ($x>0) { while ($row = mysql_fetch_array($do, MYSQL_ASSOC)) { $th.=$row["thumb_pic_path"].'|';} } echo "&total=".$x."&thumbs=".$th; ?>
  23. i have added a flash file to my php page and somehow its messing around with the php. some links and buttons on that page stopped workning. has any one ever encountered this? here is the flash code <script language="javascript" type="text/javascript"> if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'width', '1000', 'height', '100', 'movie', 'cat_thumbs', 'flashvars','category=<?php echo $item_rec[6];?>', '' ); } </script> here is an example of a page without the flash. the vote button is working http://www.officiallythehottest.com/car/ferrari/ here is an example of a page with the flash. the vote button is broken and links are broken http://www.officiallythehottest.com/car/bugatti-veyron/ any idea what the flash could be doin to my otherwize working php?
×
×
  • 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.