iScript
-
Posts
9 -
Joined
-
Last visited
Never
Posts posted by iScript
-
-
You can see the problem in the coding color...
you echoed all the if's and all the PHP statment in the switch...
-
Yes, there is a different:
$string1 = "Hi"; echo "The string1 var is $string1"; // output: the string1 var is Hi // Its not recommended to so that, the best way is to put a dot to seperate strings and vars echo 'The string1 var is $string1'; // output: the string1 var is $string1 // Good way: echo "The string1 var is " . $string1; // output: the string1 var is Hi echo 'The string1 var is ' . $string1; // output: the string1 var is Hi
Another good thing to have this two is this:
echo "<span style="color:red">spanInnerHTML</span>"; // ERROR: double quotes within double quotes... // Solution: echo "<span style=\"color:red\">spanInnerHTML</span>"; // output: <span style="color:red">spanInnerHTML</span> echo "<span style='color:red'>spanInnerHTML</span>"; // output: <span style='color:red'>spanInnerHTML</span>
-
First, it's recommended to use UPPERCASE letters for saved words like SELECT, UPDATE, DELETE and more.
Second, do you know to put a dot (.) between variables and strings?
(I don't know how to call it in English, in Hebrew its : לשרשר)
-
First, use a regular while loop. Not do_while, because you need to define the $row array before the actual loop statments.
And to your question, its pretty simply, you can use a code like this:
$query = mysql_query("SELECT * FROM `tableName` ORDER BY `columnName`"); $i = 0; echo "<table>"; echo "<tr>"; echo "<td><ul>"; while($row = mysql_fetch_assoc($query)){ $i++; if($i >= (mysql_num_rows($query) - $i)) break; echo "<li>" . $row['columnName'] . "</li>"; } $query2 = mysql_query("SELECT * FROM `tableName` ORDER BY `columnName` LIMIT " . $i . ", " . mysql_num_rows($query) - $i); echo "</ul></td><td><ul>"; while($row2 = mysql_fetch_assoc($query2)){ echo "<li>" . $row2['columnName'] . "</li>"; } echo "</ul></td>"; echo "</tr>"; echo "</table>";
I didn't test that, but it might work.
-
Store the user's sorting expression in a session
$_SESSION['sortOrder'] = $_GET['sortOrder']; /* the URL shoul'd be similar to "page.php?sortOrder=name" */
Or in a cookie:
setcookie("sortOrder",$_GET['sortOrder']);
-
Does the browser give you an alertbox?
-
Can you put here the code?
I'll try to fix it for ya.
-
in PHP:
<?php if(is_correct_username($_POST['username']) && is_correct_password($_POST['password'])){ header("Location: userSuccessLogged.php"); } ?>
in JavaScript:
<script type="text/javascript"> window.location.href = "htttp://www.google.com"; </script>
AJAX chained select boxes with mysql php populate
in PHP Coding Help
Posted
Can we have the htmlData function??
did you use an XMLHttpRequest object? and used the responseText property?