Jump to content


MadTechie

Member Since 28 Feb 2007
Offline Last Active Mar 11 2014 08:16 AM

Posts I've Made

In Topic: dynamic metatags with php and mysql

04 March 2014 - 12:36 PM

As a guess you have missed the connection to mysql

 

as mysql_fetch_array is getting a boolean (i assume false, that is an error in the query)

 

try a

result=mysql_query($query) or die(mysql_error());

and see what the error is


In Topic: list all files in a directory

04 March 2014 - 12:31 PM

Try this simple example,

<?php
$dir = dirname(__FILE__)."/"; //Get the directory where this script is located

echo "This is the full path: ".$dir
echo "<br />\n";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) { //Checks its a directory
    if ($dh = opendir($dir)) { //Access the directory
        while (($file = readdir($dh)) !== false) { //read files/folder from the directory
            echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; //display the found item directory
        }
        closedir($dh);
    }
}
?>

it should give you the full of where the script is and what files and folders are inside.

 

The most common problem is getting the path right.

 

You could change dir in the above script  to

$dir = dirname(__FILE__)."/Thumbnails/"; //Get the directory where this script is located

If the script is in the Gallery directory..

 

Hope this helps

if not then just lets us know what happened :)


In Topic: MySql code help needed

04 March 2014 - 12:17 PM

First thing I would remove the whitespace, between the  php tags

$boxerrortext = 'No duplicate boxes';
?>

<?php

if (isset($_POST['submit']))     {

but i think the main problem is with the array itself

$error[] = array(
                'boxerror'=>$boxerrortext,
                'box'=>$box
            );

should probably be

$error = array(
                'boxerror'=>$boxerrortext,
                'box'=>$box
            );

(no [])


In Topic: Need Help with POST array

26 April 2012 - 10:01 AM

The image field is infact a file
use
print_r($_FILES);
for that one,

as for the submit button
unset should work..
if not just skip it
for example
unset($_POST['submit_mod']);
//OR
foreach ($_POST as $key => $value) {
if($key=='submit_mod') continue;


Hope this helps

In Topic: PHP Combo Boxes, Saving the drop down options into SQL

26 April 2012 - 09:54 AM

Your select option is wrong
echo "<select practice=asset_register value=''>practice</option>";

it should be something like this
echo '<select name="practice">practice</option>';
then you can use $_POST['practice'] to get the selected value (like any other element)

Hope this helps

Oh and PLEASE use code tags(#) as its a pain to read and some people will just skip the thread

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com