Jump to content

fugix

Members
  • Posts

    1,483
  • Joined

  • Last visited

Everything posted by fugix

  1. a quick revision to the code above to 3 lines if ($url == 'www.specialpizza.com') $site = 'Special Pizza'; if ($url == 'www.mainstreetspecialpizza.com') $site = 'Main Street Pizza'; if ($url == 'www.elmstreetspecialpizza.com') $site = 'Elm Street Pizza'; $_SERVER['SERVER_NAME'] outputs www. included in the server name
  2. since $_GET is an associative array, you can also use array_key_exists() there are several ways to do what you want
  3. placing the code in a while loop should fix the problem of only displaying one row, however I have realized an error that i made in the previous code, I placed the closing </table> tag inside of the while loop which I should not have done....try this instead. $result = mysql_query("SELECT * FROM `members` WHERE username='".$_SESSION['username']."' limit $eu, $limit"); while($fetch_users_data = mysql_fetch_object($result)) { if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';} else{$bgcolor='#f1f1f1';} echo "<tr >"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->statementdate."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->statementtrasct."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->amounttransact."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->intacctbal."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->charges."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->acctbal."</font></td>"; echo "</tr>"; //removed the </table> tag below }
  4. since you wish to display more than one row, you will need to place you mysql_fetch_object() function inside of a while loop. Also, I recommend puting your query into a variable before using it inside of the function $result = mysql_query("SELECT * FROM `members` WHERE username='".$_SESSION['username']."' limit $eu, $limit"); while($fetch_users_data = mysql_fetch_object($result)) { if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';} else{$bgcolor='#f1f1f1';} echo "<tr >"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->statementdate."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->statementtrasct."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->amounttransact."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->intacctbal."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->charges."</font></td>"; echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$fetch_users_data->acctbal."</font></td>"; echo "</tr>"; echo "</table>"; } Edit: since "members" is not a mysql reserved word, you do not need to wrap it in backticks, however this is still acceptable
  5. ah I see, that would explain it. Glad you found your error. I don't recommend storing HTML code inside of a variable in the future, causes confusion when incorporating the variable into your code.
  6. can you show more code where you set your $imagetoshow variable
  7. you have forgotten to place you href and src attributes inside of quotations. print "<tr><td><a href='$imagetoshow'><img src='$imagetoshow'></a></td><td>$title $subtitle</td><td>$location</td><td>$blurb</td></tr>";
  8. the error isn't caused by the code that I provided, most likely your are missing a closing curly bracket somewhere. If you cant figure it out post your code and I will look at it
  9. <form method="post" action="#"> <!-- form contents --> </form>
  10. use the complex syntax on your session inside of you query, also, add some debugging just in case that fails <?php $query = "SELECT * FROM selections WHERE username = '{$_SESSION['username']}'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { ?>
  11. change print_r($_POST['senderID']); to print_r($_POST); to make sure all necessary data is being past except for the senderID, post your results
  12. why are you using javascript to validate your form instead of php? javascript can be disabled. Is your $_POST['senderID'] empty? Try using print_r($_POST); after your reply form has been submitted to see what is happening to that value
  13. I'm confused I don't understand i believe Pikachu means the actual file that contains <td><img src="images/blog/<?php echo $row_Recordset1['filename'];?>"/> </td>
  14. what are the contents of your $row_Recordset1['filename']
  15. I notice that you are using $_SERVER['PHP_SELF'] as your action in your forms. I do not recommend doing this as there are several risks to doing this, XSS injection etc... Also, can you show the code specific to handling the replies please
  16. can explain further what you mean by "response" please
  17. when you specify your $query value twice, you are actually overriding the first value of $query. I recommend doing something like this. $section1 = $_POST['section1']; $section2 = $_POST['section2']; $query="INSERT INTO selections (section1, section2) VALUES ('$section1', '$section2')"; mysql_query($query) or die ("Error updating database: " . mysql_error());
  18. if($_SESSION['user']==1){ $option='edit'; } elseif($_SESSION['user']==2){ $option='approve/deny'; } im assuming that neither of theses conditions are met, therefore you $options variable is never set
  19. fugix

    Hello! :D

    Welcome, feel free to ask us any questions along the way of your learning php
  20. http://dev.mysql.com/doc/refman/5.0/en/update.html
×
×
  • 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.