-
Posts
1,807 -
Joined
-
Last visited
Posts posted by hitman6003
-
-
First off, that post is from 2002...MySQL, at that time, was still in version 4 (maybe even late version 3, I don't remember). Since then it has made leaps and bounds. It is a perfectly viable enterprise database, and usually the only thing that people have against it is misinformation and ignorance.
That is not to say it doesn't have weaknesses. For example, SQL server has indexed views, MySQL does not. On the other hand, why do you need an indexed view and how often are you really going to use it? What MySQL lacks in *generally* seldom used features it more than makes up for in performance...especially on "low end" hardware.
The major gripe that most people have, and it's primarily administrators, is that mysql has spotty support for triggers. Developers most commonly complain about the lack of a native XML data type support.
-
MySQL server related. MySQL has a maximum number of connections (defined by the administrator). When you get this error it means that that number has been met.
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#option_mysqld_max_connections
-
-
Does your query return more than one row? If so, you are only getting the first row returned from the result set.
-
This should give you a start:
<?php $num_columns = 3; $array = range(0, 100); echo ' <table>'; for ($i = 0; $i <= count($array); $i += $num_columns) { $j = 1; echo ' <tr>'; while ($j <= $num_columns) { if (array_key_exists($i + $j, $array)) { echo ' <td>' . $array[$i + $j] . "</td>"; } else { echo ' <td> </td>'; } $j++; } echo ' </tr>'; } echo ' </table>';
-
<?php //Open images directory $dir = dir("../images"); // this shouldn't be in the while loop $per_row = 3; echo ' <table> <tr>'; $i = 0; // create the rows while (($file = $dir->read()) !== false) { $i++; // close and start another row if the correct number has been displayed if ($i % $per_row == 0) { echo ' </tr> <tr>'; } echo ' <td><img src="../images/' . $file . '" alt="my image" /></td>'; } // finish the current row while ($i % $per_row != 0) { echo ' <td> </td>'; } echo ' </tr> </table>'; } $dir->close(); ?>
-
You don't need 'useritem' in the table list when you specify an inner join...
SELECT useritem.Quantity, item.Size FROM item INNER JOIN useritem ON item.ItemID = useritem.ItemID WHERE useritem.UserID='" . $_SESSION['Current_User'] . "' AND useritem.`Where`='1'
Also, using reserved words for column names is a really bad idea...it just makes life more difficult in the long run.
Is useritem.where a numeric datatype (int, mediumint, smallint, etc), or is it a character type? If it's the latter, and it only contains numbers, change it. If it's the former, then you don't have to put the 1 in your query in quotes...MySQL only does a type conversion on it (it sees it as string because of the quotes and then converts it to match the column type), which is an extra, unnecessary operation.
-
-
if ($_POST["$submit"])
Is that correct?
-
looks like php has safe mode turned on. Which means that unless the directory you're trying to read is one of those listed, you can't.
-
You just need a "!" (not) in front.
If you did that you would return all other rows from the database...potentially MANY.
Use his second suggestion, however mysql_num_rows will not return null, but will return 0 if no matching rows were found.
You could also use a COUNT(username) query...
$query = "SELECT COUNT(username) FROM users WHERE username = '" . $username . "'"; $result = mysql_query($query) or die(mysql_error()); if (mysql_result($result, 0) > 0) { echo 'That username exists'; } else { echo 'That username is free'; }
-
ini_set('display_errors', 0);
-
-
Taken from the manual, with a very slight modification (http://www.php.net/class.dir):
<?php $i = 0; $d = dir("/etc/php5"); echo "Handle: " . $d->handle . "\n"; echo "Path: " . $d->path . "\n"; while (false !== ($entry = $d->read())) { if (is_dir($entry)) { $i++; } } $d->close(); echo "Number of directories: " . $i; ?>
-
There are allot of ways to get past a word filter using upper/lowercase letter
Use strtoupper and/or strtolower or str_ireplace.
Also, George Carlin's dirty word list: http://georgecarlin.com/dirty/2443.html
-
What do you mean "it's not showing"? It's not displaying at all? The selected field isn't being preselected? Please elaborate.
-
Is the php interpreter installed on your server?
-
This should get you started...
<?php $query = "SELECT topics_topic FROM table ORDER BY topics_topic"; $result = mysql_query($query) or die(mysql_error()); // loop the result foreach ($result as $row) { // get the first letter $first = strtolower(substr($row['topics_topic'], 0, 1)); // make sure the first letter is a letter if (str_pos('abcdefghijklmnopqrstuvwxyz', $first) !== false) { // place it in the correct position in the array $data[$first][] = $row['topics_topic']; } } // sort by keys ksort($data); // the number of columns you want $num_columns = 4; // start the table echo ' <table>'; // loop through the results foreach ($data as $letter => $topics) { // display the row with the letter echo ' <tr> <th colspan="4">' . $letter . '</th> </tr> <tr>'; $i = 0; // display the topic title in a td foreach ($topics as $topic) { // if $num_columns tds have been echo'd start a new row if ($i == $num_columns) { echo ' </tr> <tr>'; $i = 0; } echo ' <td>' . $topic . '</td>'; $i++; } // finish off the current row while ($i < $num_columns) { echo ' <td>nbsp;</td>'; $i++; } echo ' </tr>'; } // finish off the table echo ' </table>';
-
Make sure your php server can reach the SQL server...ping it to be sure.
Assuming that you used FreeTDS to create the mssql extension, use the tsql command to test the connection from the command line.
-
or using empty:
while (!empty($array)) { $current_element = array_pop($array); echo $current_element; }
-
A string must be quoted in an sql query...
bankaccount='Bronze Account'
-
Whenever you are having problems with a query there should always be two things you do before anything else...
1) echo out your query...
$query = "update players set bankaccount=$newbank[name] where id=$stat[id]"; echo $query; mysql_query($query);
2) show the mysql error(s)...
$query = "update players set bankaccount=$newbank[name] where id=$stat[id]"; echo $query; mysql_query($query) or die(mysql_error());
-
The very first comment on the abstraction page of the php manual sums it up nicely:
http://us.php.net/manual/en/language.oop5.abstract.php#82111
-
Since you are using php5, I would change to using the simplexml functions.
Extract .tar.bz2
in PHP Coding Help
Posted
http://www.php.net/book.bz2
http://www.google.com/search?hl=en&q=php+tar&btnG=Google+Search