php-windows Digest 24 May 2008 13:56:12 -0000 Issue 3478

Topics (messages 28910 through 28912):

Re: Error Question!
        28910 by: James Crow
        28911 by: bitslayer.comcast.net

Re: WMI call to run a remote application
        28912 by: Allain Lalonde

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Matt,

  You may want to watch out for is sql injection attacks. Just to be on
the safe side consider something like:
$projects = "select name, type, location, date_added from uploads where
user_id = '" . mysql_real_escape_string($_SESSION['user_id'], $conn) .
"'";

The reason for the error is $project_results != $projects_results.

Thanks,
James


On Fri, 2008-05-23 at 13:42 -0400, Matthew Gonzales wrote:
> Hello Everyone,
> 
> I keep getting this error: *Warning*: mysql_fetch_array(): supplied 
> argument is not a valid MySQL result resource in 
> *C:\wamp\www\login\testroom\upload.php* on line *107, *for this 
> particular area of code.
> 
> 
> Code:
> 
> //Check to see what files they have uploaded in the past
>     $projects = "select name, type, location, date_added from uploads 
> where user_id = '" . $_SESSION['user_id'] . "' ";
>     $projects_results = mysql_query($projects, $conn) or die(mysql_error());
>    
>     //Create table for projects
>     $display_block = '<table>
>                             <tr>
>                                 <th>Project Name</th>
>                                 <th>Project Type</th>
>                                 <th>View Project</th>
>                                 <th>Project Created</th>
>                             </tr>';
>                            
>     //Extract data to table
>     while ($project_data = mysql_fetch_array($project_results))  * Error 
> occurs here!*
>     {
>         $project_name = $project_data['name'];
>         $project_type = $project_data['type'];
>         $project_link = $project_data['loction'];
>         $project_date = $project_data['fmt_date_added'];
>        
>         //insert project data   
>         $display_block .='
>                             <tr>
>                                 <td class="heading">' . $project_name . 
> '</td>
>                                 <td class="heading">' . $project_type . 
> '</td>
>                                 <td class="heading"><a href="' . 
> $project_link . '">View</a></td>
>                                 <td> class="heading">' . $project_date . 
> '</td>
>                             </tr>';
>     }
>    
>     //Close display block
>     $display_block .='</table>';
> 
> Does anyone have any idea what is going on. I have used a similar code 
> liek this before and it worked. I can output the mysql string to the 
> browser and then copy and paste it to PHPmyadmin and do an sql query and 
> it comes back with the correct results. I don't know what is up.
> 
> Thanks!
> 
> Matt G
> 
> **
> -- 
> Matthew Gonzales
> IT Professional Specialist
> Enterprise Information Technology Services
> University of Georgia
> Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> Phone: (706)542-9538
> 


--- End Message ---
--- Begin Message ---
Matthew,

It seems, from looking at your supplied code, that you have a variable-naming 
typographic error.
The variables have to match:
$projects_results = mysql_query($projects, $conn) or die(mysql_error());
$project_data = mysql_fetch_array($project_results)) 

--
Jeff White is: 
[EMAIL PROTECTED] 


-------------- Original message -------------- 
From: Matthew Gonzales <[EMAIL PROTECTED]> 

> Hello Everyone, 
> 
> I keep getting this error: *Warning*: mysql_fetch_array(): supplied 
> argument is not a valid MySQL result resource in 
> *C:\wamp\www\login\testroom\upload.php* on line *107, *for this 
> particular area of code. 
> 
> 
> Code: 
> 
> //Check to see what files they have uploaded in the past 
> $projects = "select name, type, location, date_added from uploads 
> where user_id = '" . $_SESSION['user_id'] . "' "; 
> $projects_results = mysql_query($projects, $conn) or die(mysql_error()); 
> 
> //Create table for projects 
> $display_block = '
> 
> Project Name
> Project Type
> View Project
> Project Created
> 
'; 
> 
> //Extract data to table 
> while ($project_data = mysql_fetch_array($project_results)) * Error 
> occurs here!* 
> { 
> $project_name = $project_data['name']; 
> $project_type = $project_data['type']; 
> $project_link = $project_data['loction']; 
> $project_date = $project_data['fmt_date_added']; 
> 
> //insert project data 
> $display_block .=' 
> 
> ' . $project_name . 
> '
> ' . $project_type . 
> '
> View
> class="heading">' . $project_date . 
> '
> 
'; 
> } 
> 
> //Close display block 
> $display_block .=''; 
> 
> Does anyone have any idea what is going on. I have used a similar code 
> liek this before and it worked. I can output the mysql string to the 
> browser and then copy and paste it to PHPmyadmin and do an sql query and 
> it comes back with the correct results. I don't know what is up. 
> 
> Thanks! 
> 
> Matt G 
> 
> ** 
> -- 
> Matthew Gonzales 
> IT Professional Specialist 
> Enterprise Information Technology Services 
> University of Georgia 
> Email: [EMAIL PROTECTED] 
> Phone: (706)542-9538 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/) 
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 

--- End Message ---
--- Begin Message ---
To execute a shell statement on the server side use
http://ca3.php.net/manual/en/function.exec.php. That way you keep Web things
in PHP and Shell Script things in a more appriate language like cscript
(vbs) or batch files.

Even though PHP *can do it*, it doesn't mean it's the best language for
doing it.

My 2 cents,

Allain Lalonde

2008/5/22 John Arends <[EMAIL PROTECTED]>:

> I'd like to have a PHP script running on my web server (running IIS 6) that
> can make a WMI call and start a specific remote process on a remote
> computer.
>
> For what its worth, the remote process I'd like to trigger is a batch file.
>
> I've googled this extensively and can't find anything that points me in the
> right direction. All the sample scripts are in vbscript, but I assume I can
> probably do something like this with PHP as well since it has COM libraries.
>
> Any suggestions?
>
> -John
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to