Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. Hmm, I haven't a clue...try this: [code]echo "<pre>"; $query = "SELECT * FROM nuke_fa_bids"; $r = mysql_query($query) or die("Could not query: " . mysql_error()); while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {   print_r($row); }[/code] Just execute that code. Make sure that the arrays are full of data. If it's possible, can you post a couple of the sub arrays?
  2. Make sure error reporting is on too: [code]ini_set("error_reporting", "1"); ini_set("display_errors", "E_ALL");[/code]
  3. Are you sure your query is returning rows?
  4. Hmmm, changed how the row colors are done, and changed bid to Fbid when it's building the array: [code] $query = "SELECT * FROM nuke_fa_bids"; $r = mysql_query($query) or die("Could not query: " . mysql_error()); while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {     $player = $row['Player'];     if (!$result[$player] || $result[$player]['bid'] < $row['Fbid']) {         $result[$player]['bid'] = $row['Fbid'];         $result[$player]['team'] = $row['Team'];         $result[$player]['position'] = $row['Position'];     } } $count = 0; echo '     <table border="1" cellpadding="3" cellspacing="0">         <tr>             <th>Team</th>             <th>Player Name</th>             <th>Position</th>             <th>Winning Bid</th>         </tr>';          foreach ($result as $key => $value) {     if (($count % 2) == "0") {         $color = "D6CFCE";     } else {         $color = "0000FF";     }          echo '         <tr style="background-color:' . $color . ';">             <td align="left"><img src="images/smalllogos/'. $value[team] .'.gif"></td>             <td align="center" class="boldblacktext">' . $key . '</td>             <td align="center" class="boldblacktext">' . $value[position] . '</td>             <td align="center" class="boldblacktext">' . $value[bid] . '</td>         </tr>';         $count++; } echo '</table>';[/code]
  5. Apparently I removed too much of your script. Change: [code]$mysql_query = "SELECT * FROM nuke_fa_bids ORDER BY Player ASC, Fbid DESC"; while ($row = mysql_fetch_array($mysql_query, MYSQL_ASSOC)) {     $player = $row['Player'];     if (!$result[$player] || $result[$player]['bid'] < $row['bid']) {         $result[$player]['bid'] = $row['Fbid'];         $result[$player]['team'] = $row['Team'];         $result[$player]['position'] = $row['Position'];     } }[/code] to: [code]$query = "SELECT * FROM nuke_fa_bids ORDER BY Player ASC, Fbid DESC"; $r = mysql_query($query) or die("Could not query: " . mysql_error()); while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {     $player = $row['Player'];     if (!$result[$player] || $result[$player]['bid'] < $row['bid']) {         $result[$player]['bid'] = $row['Fbid'];         $result[$player]['team'] = $row['Team'];         $result[$player]['position'] = $row['Position'];     } }[/code] That should fix it.
  6. Try this, it eliminates all of your repetitive querys...there is only one now. [code]$mysql_query = "SELECT * FROM nuke_fa_bids ORDER BY Player ASC, Fbid DESC"; while ($row = mysql_fetch_array($mysql_query, MYSQL_ASSOC)) {     $player = $row['Player'];     if (!$result[$player] || $result[$player]['bid'] < $row['bid']) {         $result[$player]['bid'] = $row['Fbid'];         $result[$player]['team'] = $row['Team'];         $result[$player]['position'] = $row['Position'];     } } $tdbgcolor = array("D6CFCE","0000FF"); $count = 0; echo '     <table border="1" cellpadding="3" cellspacing="0">         <tr>             <th>Team</th>             <th>Player Name</th>             <th>Position</th>             <th>Winning Bid</th>         </tr>';          foreach ($result as $key => $value) {     echo '         <tr style="background-color:' . $tdbgcolor[$count%2] . ';">             <td align="left"><img src="images/smalllogos/'. $value[team] .'.gif"></td>             <td align="center" class="boldblacktext">' . $value[player] . '</td>             <td align="center" class="boldblacktext">' . $value[position] . '</td>             <td align="center" class="boldblacktext">' . $key . '</td>         </tr>';         $count++; } echo '</table>';[/code]
  7. [code]$text = str_replace("ö", "&ouml;", $text);[/code] Where $text is the text that contains the characters.
  8. [code]function datediff($start, $end) {     //will only work with date in format of dd/mm/yyyy     $s = explode("/",$start);     $e = explode("/",$end);          $st = mktime(NULL, NULL, NULL, $s[1], $s[0], $s[2]);     $et = mktime(NULL, NULL, NULL, $e[1], $e[0], $e[2]);          $daysofdifference = floor(($et - $st) / 86400);          return $daysofdifference; } $diff = datediff('18/11/2005', date('d-m-Y)); echo "days since last visit: $diff";[/code]
  9. date_format is not a php function, therefor you would have to use php's strtotime and date functions for format your dates correctly. [code]$date = '2006-02-26'; $date = strtotime($date); $newdate = date("m-d", $date); $query = "SELECT * FROM table_name WHERE date_format(db_date,'%m %d') = '$newdate'";[/code] Or, this might work, but don't hold me to it: $date = '2006-02-26'; [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]table_name[/color] [color=green]WHERE[/color] date_format(db_date,[color=red]'%m %d'[/color]) [color=orange]=[/color] date_format([color=red]'$date'[/color], [color=red]'$m $d'[/color]) [!--sql2--][/div][!--sql3--]
  10. Your only other option for storing each field as they are entered is ajax.
  11. Use javascript to store the values in a cookie. [a href=\"http://www.w3schools.com/js/js_cookies.asp\" target=\"_blank\"]http://www.w3schools.com/js/js_cookies.asp[/a] Then when they come back to the site, you should be able to retrieve the vars in either php or javascript.
  12. Create two spans inside of your td/div, give one style="text-align: left" the other "text-align: right"
  13. Execute this query: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']UPDATE[/span] videos SET playcount [color=orange]=[/color] (playcount [color=orange]+[/color] 1) [color=green]WHERE[/color] id [color=orange]=[/color] [color=red]'$id'[/color] [!--sql2--][/div][!--sql3--]
  14. As always, read the manual: [a href=\"http://www.php.net/is_dir\" target=\"_blank\"]http://www.php.net/is_dir[/a]
  15. The password is probably blank. $connect = mysql_connect("localhost", "root", "") Use phpMyAdmin to change that asap if your server is accessable from the internet.
  16. [!--quoteo(post=349574:date=Feb 26 2006, 10:43 AM:name=joecooper)--][div class=\'quotetop\']QUOTE(joecooper @ Feb 26 2006, 10:43 AM) [snapback]349574[/snapback][/div][div class=\'quotemain\'][!--quotec--] It will need to load everyone of those rows on a single page also using a loop script... [/quote] Longer load times on your webpage due to all the data being downloaded. If there is a lot of traffic to your site, doing it over and over and over will slow your server down. MySQL can handle a lot more than 10k rows, so that isn't a problem.
  17. Reverse your tables in your sql statement: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]customer[/color] [color=green]LEFT[/color] [color=green]JOIN[/color] case ON customer.custID [color=orange]=[/color] case.custID [!--sql2--][/div][!--sql3--]
  18. [code]<?php if (isset($_POST)) {     //connect to your db     include 'config.php';     mysql_select_db($usersdb);          //get and escape your two user inputs     $username = mysql_real_escape_string($_POST['username']);     $password = mysql_real_escape_string($_POST['password']);          //rather than trying to retrieve the password, then check to see if they match in php,     //use the following query and let SQL do that work for you.     $pquery = "SELECT username FROM userinfo WHERE userid = '$username' AND password = '$password'";     $result = mysql_query($pquery) or die("Could not query: " . mysql_error());          //if one row was returned, then the username/password combo was found     if (mysql_num_rows($result) == 1) {         echo "User Authenticated";     } else if (mysql_num_rows($result) == 0) { //if no rows are returned, then the user was not in the db         echo "User not found";     } else {  //you may have more than one entry for the same person...which is bad.         echo "Error occurred during verification";     }          //header("nextpage.php");     exit; } ?> <form method="Post" action="<?php $_SERVER['PHP_SELF']; ?>"> <p> Username: <input type='text' name='username' /> </p> <p>Password: <input type='text' name='password' /><br /> <input type='submit' name="submit" value="Submit"/> </p> </form>[/code]
  19. Why is everyone so interested in doing this the last few days? In addition to fopen and fread, you can use file_get_contents (http://www.php.net/file_get_contents) and the cURL functions (http://www.php.net/curl).
  20. [!--quoteo(post=349490:date=Feb 26 2006, 12:23 AM:name=davinci)--][div class=\'quotetop\']QUOTE(davinci @ Feb 26 2006, 12:23 AM) [snapback]349490[/snapback][/div][div class=\'quotemain\'][!--quotec--] Is there a way to make it that each video in the table has its own html page generated, maybe something along the lines of ../videofilename.html instead of ../mediaplayer.php?id=x? [/quote] You could, but why? You would end up with a bunch of .html files on your server, and they would all be exactly the same, execpt for the filename and the name of the video to be played. And, if you ever had to change where the media player looked for it's information, or anything else that would be a "global" change, you would have to go back and change all those files, not just one.
  21. You have to read the file some way in order to get the file size. If you are using a file upload form, then you can use the $_FILES array after it's been submitted, which has the file size in it. Here is a function using cURL from, of all places, the manual: [a href=\"http://us2.php.net/manual/en/function.filesize.php#47552\" target=\"_blank\"]http://us2.php.net/manual/en/function.filesize.php#47552[/a]
  22. Straight on to the manual, hang a left to the cURL functions (http://www.php.net/curl), if you don't like that, take a right to file_get_contents (http://www.php.net/file_get_contents) and the other file reading functions.
  23. [!--quoteo(post=349521:date=Feb 26 2006, 06:38 AM:name=dannyboy194)--][div class=\'quotetop\']QUOTE(dannyboy194 @ Feb 26 2006, 06:38 AM) [snapback]349521[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, I was wandering is there a way so when my mysql database is updated with information, a php file is automatically updated with the information. [/quote] Yes. [!--quoteo(post=349521:date=Feb 26 2006, 06:38 AM:name=dannyboy194)--][div class=\'quotetop\']QUOTE(dannyboy194 @ Feb 26 2006, 06:38 AM) [snapback]349521[/snapback][/div][div class=\'quotemain\'][!--quotec--] (this makes it far easier to write a search script) [/quote] In my experiance it is always easier to search a MySQL database than a text file, but, whatever floats your boat.
  24. By far, the best php book you can read is the manual. [a href=\"http://www.php.net/manual/en/\" target=\"_blank\"]http://www.php.net/manual/en/[/a] And, it's free. Pick a project that you want to code, start on it. Do internet searches, ask questions on the forum, and read the manual...you will learn more from that project that you will from 100 books.
  25. Did you notice what I changed in your code? I didn't just clean it up for you.
×
×
  • 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.