pocobueno1388
Members-
Posts
3,369 -
Joined
-
Last visited
Never
Everything posted by pocobueno1388
-
It's kinda hard to figure out what you want...but I'm guessing something like this <?php $var = mysql_real_escape_string($_GET['var']); $query = "SELECT * FROM table WHERE col='$var'"; $result = mysql_query($query)or die(mysql_error()); while ($row = mysql_fetch_assoc($result)){ echo $row['col'].'<br>'; } ?>
-
[SOLVED] Scratching my head over this one... Select menu
pocobueno1388 replied to suttercain's topic in PHP Coding Help
Ah, I meant for you to only change that specific part of the code that I posted, not erase everything else. Okay, so do this so I can see <?php require('includes/get_connected.php'); $query = "SELECT * FROM comics WHERE comic_id= '45'"; $result = mysql_query($query); $num = mysql_num_rows($result); $i = 0; while ($i<$num) { $age = mysql_result($result, $i, 'age'); $TheList = array("Select Twe" => 0, "Golden" => "Golden", "Silver" => "Silver", "Bronze" => "Bronze", "Modern" => "Modern"); echo "<select name='ud_age'>"; foreach($TheList as $K => $V) { if ($V == $age) { $sel = "selected"; } else { $sel = ""; } echo "<option value='$V' $sel>$K - $V - $age</option>"; } echo "</select>"; ++$i; } ?> -
[SOLVED] Scratching my head over this one... Select menu
pocobueno1388 replied to suttercain's topic in PHP Coding Help
BAM! There is your problem. Notice how your $age variable is empty? So your probably not getting the results from the database properly. Can you post more of you code? Post the query and everything...I need to see what your doing with that variable. -
[SOLVED] Scratching my head over this one... Select menu
pocobueno1388 replied to suttercain's topic in PHP Coding Help
Okay, try this code and post us the link to where we can view it as well. <?php $TheList = array( "Select Twe" => 0, "Golden" => "Golden", "Silver" => "Silver", "Bronze" => "Bronze", "Modern" => "Modern"); echo "<select name='ud_age'>"; foreach($TheList as $K => $V) { if ($V == $age) { $sel = "selected"; } else { $sel = ""; } echo "<option value='$V' $sel>$K - $V - $age</option>"; } echo "</select>"; ++$i; } ?> -
Exactly why are you trying to avoid using the date function?
-
You should be able to do that by just setting the tables width to whatever the banners width is. This is really just an HTML problem.
-
The information is already stored in an array when it comes out of the database, why would you restore it in a different one?
-
I don't understand what you want...explain a little more.
-
[SOLVED] Scratching my head over this one... Select menu
pocobueno1388 replied to suttercain's topic in PHP Coding Help
Your page is kinda messed up cooldude...but it worked for me also. I have no idea whats going on for you suttercain. -
[SOLVED] Scratching my head over this one... Select menu
pocobueno1388 replied to suttercain's topic in PHP Coding Help
This works fine for me <?php $TheList = array( "Select Twe" => 0, "Golden" => "Golden", "Silver" => "Silver", "Bronze" => "Bronze", "Modern" => "Modern"); $age = 'Silver'; echo "<select name='ud_age'>"; foreach($TheList as $K => $V){ if ($V == $age) { $sel = "selected"; } else { $sel = ""; } echo "<option value='$V' $sel>$K - $V</option>"; } echo "</select>"; ?> Check your value from the database ($age). -
No, you can't do anything client side with PHP. I would suggest looking into AJAX or JavaScript.
-
[SOLVED] How to make an array with query results? (Postgresql)
pocobueno1388 replied to atl_andy's topic in PHP Coding Help
Try pg_fetch_array() http://us3.php.net/manual/en/function.pg-fetch-array.php -
This is such a common question that there is a tutorial made for it http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
-
Google http://www.eoghanobrien.com/article/7/php-rating-system-tutorial http://www.phptoys.com/e107_plugins/content/content.php?content.75 http://www.zenphoto.org/support/topic.php?id=1095
-
Okay, here is some code to give you a start. <?php //check if they submitted the form if (isset($_POST['submit'])){ if ($_POST['action'] == 'buy'){ echo "These are the items that were selected [they chose 'buy']<br>"; //Loop through the selected items foreach ($_POST['selected'] as $itemID){ echo $itemID.'<br>'; //this is where you would do your query } } else { echo "They chose 'sell'"; } } $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ")or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<form action='{$_SERVER['PHP_SELF']}' method='post'>"; print '<table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)) { print "<tr>"; print "\t<td><font face=arial size=1/>"; print "<input type='checkbox' name='selected[]' value='{$get_info['item_id']}' />" .$get_info['item_name']. $get_info['item_id']."</font></td>"; print "</tr>"; } echo '<select name="action">' .'<option value="buy">Buy</option>' .'<option value="sell">Sell</option>' .'</select><p>'; echo '<input type="submit" name="submit">'; echo '</form>'; ?> Let me know if you have any problems with it.
-
[SOLVED] what is the best way to do this?
pocobueno1388 replied to shedokan's topic in PHP Coding Help
Nope, your way works just fine =] -
[SOLVED] what is the best way to do this?
pocobueno1388 replied to shedokan's topic in PHP Coding Help
First off, how are you determining what the name of the link is? Are you pulling them from the database, an array, or what? -
Your confusing me. The problem you just posted is completely different than what you posted in the original post. From your fist post, it sounds like this is the chunk of code your having problems with <?php $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ") or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print '<table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)){ print "<tr>"; print "\t<td><font face=arial size=1/>"; print '<input type="checkbox" name="namehere" />'.$get_info['item_name']. $get_info['item_id'].'</font></td>'; print "</tr>"; } ?> Tell us exactly what the problem is, and what you would like to happen.
-
Show us your query.
-
You don't need us doing all the work for you, I will give you the basics. To register a session $_SESSION['var'] = "var"; To check if a session exists if (isset($_SESSION['var'])){ //It's set } You need to call session_start(); at the beginning of every file. Thats basically call the information you need...now just go replace all the cookies to sessions.
-
[SOLVED] what is the best way to do this?
pocobueno1388 replied to shedokan's topic in PHP Coding Help
You could do something like this... <?php for($i=1; $i<=4; $i++){ if ($i == 1) echo 'Link'.$i.' | '; else echo "<a href='page.php?id=$i'>link$i</a> | "; } ?> -
Well...you need to figure out where that error is coming from to figure out whats wrong. I assume it's coming from your connection script...so something still must be wrong.
-
Change include('connect.php); To include('connect.php');
-
Looks like you have the wrong username or host. You might want to check in with your host to see if you are supposed to use "localhost".