GetSimple Support Forum

Full Version: SimpleShop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I'm coding a simple Shop plugin to GS from existing shop. I'm stuck to situation where I'm trying to fetch data from db to gs plugin admin area and nothing gets printed...

Test code looks like this:
PHP Code:
require 'plugin/config.php';

    
$query "SELECT * from " $db_database "." $db_table "_category";
    
$result mysqli_query($db$query);

    if (
mysqli_num_rows($result)>0) {
        while (
$row mysqli_fetch_assoc($result)) {
            echo 
'<pre>';
            
print_r($row);
        }
    } 

config.php is the file where the connections are made and they are ok.

Anyone who could help me with this...?
Check if there are any Results
PHP Code:
require 'plugin/config.php';

    
$query "SELECT * from " $db_database "." $db_table "_category";
    
$result mysqli_query($db$query);

// Are there any results?
echo "Count mysqli_num_rows:".mysqli_num_rows($result);

    if (
mysqli_num_rows($result)>0) {
        while (
$row mysqli_fetch_assoc($result)) {
            echo 
'<pre>';
            
print_r($row);
        }
    } 
(2013-03-13, 20:43:46)timme Wrote: [ -> ]Check if there are any Results
PHP Code:
require 'plugin/config.php';

    
$query "SELECT * from " $db_database "." $db_table "_category";
    
$result mysqli_query($db$query);

// Are there any results?
echo "Count mysqli_num_rows:".mysqli_num_rows($result);

    if (
mysqli_num_rows($result)>0) {
        while (
$row mysqli_fetch_assoc($result)) {
            echo 
'<pre>';
            
print_r($row);
        }
    } 

Hey! Thanks for the reply. Alltough there was a minor error in config.php.

and now I have a second error Smile
While there's only one $_GET (ex. load.php?id=shop&page=category ) everything is fine. When I assign one more (ex. load.php?id=shop&page=edit&id=1 ) errors appear...

Aaarrgghh...

Thanks again Smile
You have 2 ids, id is used internally for the slug or plugin.
Also are you using _get variables in your query ? That is an sql injection.
(2013-03-13, 23:12:50)shawn_a Wrote: [ -> ]You have 2 ids, id is used internally for the slug or plugin.
Also are you using _get variables in your query ? That is an sql injection.

Ok, thanks. I didn't know about the ids used internally. And no, I'm not using global variables in my query Smile

Thanks!
id=shop&page=edit&id=1
2 ids.

probably want to use pid or something.