Jump to content

Stipe

New Members
  • Posts

    7
  • Joined

  • Last visited

Stipe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow! I totally forgot about case sensitivity! Thank you so much though I'm a little embarrassed it was all due to that I'll probably have more problems on different parts of this page so watch this space! Lol! I'll edit my php.ini thanks
  2. The query is run straight from the .php file not phpMyAdmin or MySQL console As for the source it as the page is: <tr align="left" bgcolor="#555555"> <td bgcolor="#555555" align="left"></td> <td bgcolor="#555555" align="left"></td> <td bgcolor="#555555" align="left"><a href="?view=24">View</a></td> </tr> When that should be: <tr align="left" bgcolor="#555555"> <td bgcolor="#555555" align="left">No Owner</td> <td bgcolor="#555555" align="left">System Phones</td> <td bgcolor="#555555" align="left"><a href="?view=24">View</a></td> </tr>
  3. Thank you! The table now looks good, but I'm not sure still why the table isnt auto filling with the info needed, any help on this?
  4. Last time i posted here i wasnt clear enough or supplied enough info, so this time around i will supply more info hopefully enough! Firstly the problem: Simple, my table isn't working as it should, I've tried to compare it to others on other pages but clueless as to why it doesn't work, it displays this: The table should be 4 rows with Owner and Name in there already, all the views should be below one another on another row, here is the coding: $sql3 = "SELECT * FROM phonecompany ORDER by id"; $result3 = mysql_query($sql3); ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel=stylesheet href=includes/in.css type=text/css> </head> <body><br> <td bgcolor="#444444"><form name="form1" method="post" action=""> <br> <table width="700" border="0" align="center" cellpadding="3" cellspacing="1" class="data_table"> </tr> <tr align="left" class="head_cell"> <th class="header" colspan="6">• Phone Companies</th> </tr> <tr bgcolor="#555555"> <td height="8" colspan="6" valign="top"><img src="images/phone.png" name="img" width="700" height="100" border="0" id="img"></td> </tr> <tr align="left" class="head_cell"> <th class="header" width="25%">Owner</th> <th class="header" width="65%">Name</th> <th class="header" width="10%"> </th> </tr> <? while($phonecompany2 = mysql_fetch_object($result3)){ ?> <tr align="left" bgcolor="#555555"> <td bgcolor="#555555" align="left"><?php echo "$phonecompany2->Owner"; ?></td> <td bgcolor="#555555" align="left"><?php echo "$phonecompany2->Name"; ?></td> <td bgcolor="#555555" align="left"><a href="?view=<?php echo "$phonecompany2->id"; ?>">View</a></td> </tr> </table> <? } ?> <p> </p> </div> </div> </form> </body> </html> And here is how the database looks: If someone could fix my code for me i would greatly appriciate it
  5. Because there are 8 locations and i want 4 banks, and if you are a bank owner i want you to be able to access your bank CP from everywhere so it doesnt matter on where your bank is or where you are
  6. Not quite what i was after but thank you suppose my explaining was a bit off lol Basically you were right about each bank having its own row, but what the script does is randomize which bank is primarily selected and you can choose another one from there, but the banks before were picked up depending where you were, instead i want it so you can create them and view anywhere, so locations in bank has been deleted and instead of picking one up and it just changing the owner in the DB its done now by creating a line up to a max and deleting if you lose it... So instead of the $bankle = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Arnhem - Netherlands'")); part, i want it to work so the vaibles are by what row number it is rather than what location it is
  7. Basically I'm working on a game and have decided to change the way banks work on it, i had it so selecting which bank you used was randomized, but i achieved this by using locations, now I've scraped them and don't know how to sort the code out to randomize with row numbers instead of location names, if that makes sense.... Here is the relevent code: $username=$_SESSION['username']; $query=mysql_query("SELECT * FROM users WHERE username='$username'"); $fetch=mysql_fetch_object($query); $bank = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = '".$fetch->location."'")); $fetch_owner = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username` = '".$bank->owner."'")); $bankle = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Arnhem - Netherlands'")); $bankpf = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Barcelona - Spain'")); $bankri = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Birmingham - England'")); $bankbg = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'New York - America'")); $bankms = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Munich - Germany'")); $banksp = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Sicily - Italy'")); $bankdu = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Oslo - Norway'")); $banktc = mysql_fetch_object(mysql_query("SELECT * FROM `bank` WHERE `location` = 'Mexico City - Mexico'")); $rand = rand(1, ; if ($rand == "1"){ $selected1 = "selected"; }elseif ($rand == "2"){ $selected2 = "selected"; }elseif ($rand == "3"){ $selected3 = "selected"; }elseif ($rand == "4"){ $selected4 = "selected"; }elseif ($rand == "5"){ $selected5 = "selected"; }elseif ($rand == "6"){ $selected6 = "selected"; }elseif ($rand == "7"){ $selected7 = "selected"; }elseif ($rand == "8"){ $selected8 = "selected"; } And the HTML side: <td bgcolor="#555555" align="left"><select name="whatbank" class="select_box" id="whatbank" style="width:250px" title="The bank to transfer the funds with."> <option value="<?php echo "$bankle->id"; ?>" <?php if ($rand == "1"){ echo "selected"; } ?>><?php echo "$bankle->bank"; ?> (<?php echo "$bankle->commission"; ?>%)</option> <option value="<?php echo "$bankpf->id"; ?>" <?php if ($rand == "2"){ echo "selected"; } ?>><?php echo "$bankpf->bank"; ?> (<?php echo "$bankpf->commission"; ?>%)</option> <option value="<?php echo "$bankri->id"; ?>" <?php if ($rand == "3"){ echo "selected"; } ?>><?php echo "$bankri->bank"; ?> (<?php echo "$bankri->commission"; ?>%)</option> <option value="<?php echo "$bankbg->id"; ?>" <?php if ($rand == "4"){ echo "selected"; } ?>><?php echo "$bankbg->bank"; ?> (<?php echo "$bankbg->commission"; ?>%)</option> <option value="<?php echo "$bankms->id"; ?>" <?php if ($rand == "5"){ echo "selected"; } ?>><?php echo "$bankms->bank"; ?> (<?php echo "$bankms->commission"; ?>%)</option> <option value="<?php echo "$banksp->id"; ?>" <?php if ($rand == "6"){ echo "selected"; } ?>><?php echo "$banksp->bank"; ?> (<?php echo "$banksp->commission"; ?>%)</option> <option value="<?php echo "$bankdu->id"; ?>" <?php if ($rand == "7"){ echo "selected"; } ?>><?php echo "$bankdu->bank"; ?> (<?php echo "$bankdu->commission"; ?>%)</option> <option value="<?php echo "$banktc->id"; ?>" <?php if ($rand == "8"){ echo "selected"; } ?>><?php echo "$banktc->bank"; ?> (<?php echo "$banktc->commission"; ?>%)</option></td> Hope you guys can help me! Much appriciated!
×
×
  • 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.