Search found 9 matches

by Sarok
Wed Jan 14, 2004 1:54 pm
Forum: PHP - Code
Topic: Newbie need help about PHP poll code
Replies: 16
Views: 1247

$_SERVER['PHP_SELF'], or as it is in your script, $PHP_SELF is a var cotaining a string with the current file's location. I havent read your entire script, havent got the time, but try to change $PHP_SELF to $_SERVER['PHP_SELF']. Also, if you can get up a link with your script in action it would hel...
by Sarok
Tue Jan 13, 2004 6:51 pm
Forum: PHP - Code
Topic: "Get the contents from a directory" Question
Replies: 2
Views: 453

Well, you can use something like: <?php // This is just a cut from the function.. function getFiles($dir = "", $sort = "type", $sortasc) { // This can of course be optimized for your needs, and/or be declared elsewhere. $extension_array = array(1 => 'jpg', 2 => 'gif', 3 => 'png')...
by Sarok
Tue Jan 13, 2004 6:29 pm
Forum: PHP - Code
Topic: Newbie need help about PHP poll code
Replies: 16
Views: 1247

The errors you are getting, is as AVATAr is saying, you are refering to undefined variables. One way to fix this is to use [php_man]empty[/php_man] in an if statement. As in:

Code: Select all

<?php

if (!empty($action) AND $action == 'logout') 
{

     echo 'Do stuff here.';

}

?>
by Sarok
Tue Jan 13, 2004 3:17 pm
Forum: PHP - Code
Topic: Newbie need help about PHP poll code
Replies: 16
Views: 1247

post your code from admin.php , and it will be easier to help.
by Sarok
Fri Jan 09, 2004 10:34 pm
Forum: PHP - Code
Topic: HereDoc not working properly
Replies: 9
Views: 957

what error messages are you getting? maybe a little easier to help then.. turn error reporting to E_ALL. maybe it helps..
by Sarok
Wed Jan 07, 2004 10:12 am
Forum: PHP - Code
Topic: printing the key and its value from mysql select query
Replies: 11
Views: 587

A quick method: <?php $query = "SELECT field, value from table"; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_assoc($result)){ echo 'Field is: ' . $row['field'] . ' and value is ' . $row['value'] . '<br>'; } } ?>
by Sarok
Sat Jan 03, 2004 11:30 am
Forum: PHP - Code
Topic: Best Way
Replies: 8
Views: 2232

The reason you are getting the error message, (Warning: mysql_result():), is because when you delete a link in your table. The script will try to get mysql_result from an empty row. As in, you got no result checking, so example; if you delete linkid "35", your script will try to get result...
by Sarok
Fri Jan 02, 2004 12:41 pm
Forum: PHP - Code
Topic: Show 3 columns per row
Replies: 3
Views: 381

if($i % 3) { // start a new row $content .= <<< TR </tr> <tr> TR; } else { Dont know if its intentional or if it works or anything.. But the If statement seems to be wrong. % is modulus, as in remainder of $a divided by $b. Try changing to if($i == 3) {
by Sarok
Fri Jan 02, 2004 12:20 pm
Forum: PHP - Code
Topic: Best Way
Replies: 8
Views: 2232

I dont know if you'd prefer a file or a mysql database. But if you want to use a database to store settings, just create a table called settings or something. Then add a Setting and a Value column. Then you can just use a code like below: <?php $query = "SELECT * from settings ORDER BY setting&...