sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
try $whereNow = ($_GET['whereNext']) ? $_GET['whereNext'] : '1'; $sqlQuery = "select * from table where authorised='true' limit $whereNow, 1"; $sql = mysql_query($sqlQuery); $recordQuery = mysql_query("select count(*) as total from table"); $recordResult = mysql_result($recordQuery, "total"); $previous = ($whereNow == 0) ? null: ($whereNow-1); $random = rand(0, $recordResult - 1); $next = ($whereNow == $recordResult - 1) ? null : ($whereNow+1);
-
are you shure to save changes in function in your 1st code echo statesment first build string for output in building string first call function (it print name on screen) and use what function return (in 1st code nothing) after that print on page using '' for name
-
in function change last line echo $query; to return $query;
-
try <?php $result = mysql_query("SELECT Owner, SUM(TotalPoints) as points FROM data GROUP BY Owner ORDER BY Owner",$db); while ($row = mysql_fetch_array($result)){ echo 'Owner: ',$row['Owner'],' - ',$row['points'],' point(s).<br />'; } ?>
-
can we see player_table function
-
you need to add 2nd parameter in fgets() function function fgets(resource $fp, int $length) for example $buffer2[]= fgets($fd, 1024);
-
<?php $sql = 'SELECT * FROM `forums` LIMIT 0, 30 '; $result = mysql_query($sql) or die(mysql_error()); // <-- inser this line while ($row = mysql_fetch_array($result) { echo ('Forum 1: '. $row['forum_name'] .'<br><br>'. $row['forum_desc'] .'<br><br>'); } ?>
-
[SOLVED] Help with extracting a specific part of an URL
sasa replied to bronzemonkey's topic in PHP Coding Help
try <?php $a = 'http://www.somewebsite.com/IWANTTHIS/this-is-unwanted-and-variable/'; $a = explode('/', $a); echo $a[3]; ?> -
try <form method="POST"> <input type="submit" name="name1" value="Click me" /> <input type="submit" name="name2" value="Click me" /> <input type="submit" name="name3" value="Click me" /> <input type="submit" name="name4" value="Click me" /> </form> <?php $post_fliped=array_flip($_POST); echo $post_fliped['Click me']; ?>
-
your where part of $sql select all rovs where propert_type = 'House' and all rows where `property_type` like 'Site' and `area` like '$county' and `town_city` like '$town' and `price` > ($minprice + 1) and `price` < ($maxprice + 1) and `bedrooms` > ($minbeds - 1) and `bedrooms` < ($maxbeds + 1) doe's it what you want i think zhat you want $sql = "SELECT * FROM `cheap_tabl` WHERE (`property_type` like 'House' OR `property_type` like 'Site') and `area` like '$county' and `town_city` like '$town' and `price` > ($minprice + 1) and `price` < ($maxprice + 1) and `bedrooms` > ($minbeds - 1) and `bedrooms` < ($maxbeds + 1) ORDER BY cheap_id DESC LIMIT $from, $max_results";
-
try <?php $query = "SELECT * FROM images"; $target = mysql_query($query); // uses the query variable defined above. confirm_query($target); // calls to the function file. while ($final_target = mysql_fetch_array($target)) { $submitter = "{$final_target["picsubmit"]}"; $description = "{$final_target["picdesc"]}"; echo '<div style="float:left;padding:10px;border:2px solid;margin-left:-2px;margin-top:-2px">': echo "<a href='{$final_target['picpath']}' target='blank'><img src='{$final_target['tnpath']}'></a>"; echo "<div align=\"left\">" . $description . "<br>" . "</div>"; echo "<br>" . "Submitted By: " . $submitter; //echo "<h4>" . "<hr>" . "</h4>"; echo "</div>"; } ?>
-
for debug try to echo $sql if ($prop_type == "%"){ echo $sql = "SELECT * FROM `cheap_tabl` WHERE `property_type` like 'Agricultural Land' OR `property_type` like 'Business' and `area` like '$county' and `town_city` like '$town' and `price` > ($minprice + 1) and `price` < ($maxprice + 1) and `bedrooms` > ($minbeds - 1) and `bedrooms` < ($maxbeds + 1) ORDER BY cheap_id DESC LIMIT $from, $max_results"; $sirsql = mysql_query($sql) or die(mysql_error()); } elseif ($prop_type != "%"){ echo $sql = "SELECT * FROM `cheap_tabl` WHERE `property_type` like '$prop_type' and `area` like '$county' and `town_city` like '$town' and `price` > ($minprice + 1) and `price` < ($maxprice + 1) and `bedrooms` > ($minbeds - 1) and `bedrooms` < ($maxbeds + 1) ORDER BY cheap_id DESC LIMIT $from, $max_results"; $sirsql = mysql_query($sql) or die(mysql_error()); }
-
insert line $UnServiceable = $Serviceable = $Minor = $Major = $Minorstar = ""; before line if($row['10'] == 0) { $UnServiceable = "selected"; } elseif...
-
it is same with if($result['searchResults']['ArrayOfString']) $num_of_res = count($result['searchResults']['ArrayOfString']) else $num_of_res = 0;
-
try $num_of_res = $result['searchResults']['ArrayOfString'] ? count($result['searchResults']['ArrayOfString']) : 0;
-
try $name = $_POST["name$i"]; or $name = $_POST['name'.$i];
-
you must specified method="POST" in form tag default is GET and $i = 1 must be inside <?php tag
-
try foreach($_POST as $key => $value) $$key = $value;
-
[SOLVED] Selecting php into tables with multiple columns?
sasa replied to mkoenig's topic in PHP Coding Help
try echo '<table>'; while ($record = mysql_fetch_assoc($result)) { echo '<tr>; // echo data echo '<td><img src="', $record['field name'],'"></img></td>'; for( $i = 1; $i < 4; $i++) { if ($record = mysql_fetch_assoc($result)) echo '<td><img src="', $record['field name'],'"></img></td>'; else echo '<td> </td>'; } echo '</tr>'; } echo '</table>'; -
try for ($i = 1; $i < 6; $i ++) { if (${'m'.$i} != "") { echo "<td height='10%' align='right' valign='top' class='style11'>Machine [$i]:</td> <td>".${'m'.$i},"</td> <td height='10%' align='right' valign='top' class='style11'>Machine [$i] Taken:</td> <td>",${'m'.$i.'t'},"</td> <td height='10%' align='right' valign='top' class='style11'>Machine [$i] - My percentage</td> <td>",${'m'.$i.'c'},"</td>"; } else { //display nothing } }
-
change line $totalrows = mysql_num_rows($result_count); to $totalrows = mysql_result($result_count, 0, 0); and line if($i == $pie){ to if($pid == $pie){
-
try $insertGoTo = "show_inventory.php?recordID=" . $row_rs_add_inventory['id'];
-
try <?php $a = array(1,2,3,4,5,6); shuffle($a); $o = array_chunk($a, 2); print_r($o); ?>
-
while($qry2=mysql_fetch_array($qry1)) $graphValues[] = $qry2[0];
-
change line while ($x[--$i] != ' '); to while (!in_array($x[--$i], array(".", "?", "!", "\n", "\r"));