php

C# struct and NuSOAP(php)

Hello Im trying to build a client in c# that talks with some remote (php)server with SOAP using the NuSOAP library. Here im using a struct/object that will containt the user info of some user: public struct UserProfile { public string username; public string password; public string email; ...

mysql_fetch_assoc() returning unexpected value

I am working on a project where I use mysql_fetch_assoc to return an associative array. However, I am puzzled as to why it would return TRUE I have looked at the PHP manual page, and the only boolean value it should be returning is FALSE, and then only on a fail. Although I am using a custom set of abstraction classes, it is basically...

PHP Regex problem with a complex target string

Hi, i need to parse dhcp leases table with php regex. but the thing is it contains different characters used in regex too. here is sample output lease 172.17.2.3 { starts 4 2009/07/16 11:54:39; ends 4 2009/07/16 12:54:39; cltt 4 2009/07/16 11:54:39; binding state active; next binding state free; hardware ethernet 00:50:56...

Error in SQL UPDATE query

$result = mysql_query("UPDATE categories SET cd_title='$docuTitle' , cd_link='$linkTitle' WHERE c_name='$catID'"); What is wrong with this update query? ...

PHP SQL Server Insert issue

The following statement runs fine in the MS SQL server management studio. However when I try to execute via PHP the insert does not occur and no errors are returned. I know my connection is valid, all my select statements return properly. What am I missing? DECLARE @id bigint; SET @id = (SELECT MAX(application_track_id) + 1 FROM appl...

PHP Sessions stored in MySQL in Ajax heavy environment

I'm looking to change my application to store PHP Session data in MySQL. The application is ajax intensive but does not utilize long-polling or any other type of persistent connection. My question is, are there any gotcha's I need to be aware of when writing this code? For example; I have a page that sends 4 ajax requests to load da...

Storing Image Locations with MySQL and PHP

How to store image location In MySQL? ...

Insert and Update at same time.

$result = mysql_query("INSERT INTO categories (cd_title , cd_link ) VALUES ('$docuTitle','$linkTitle')"); This works fine, but i want to update these values in another field in same table. Once these two are successful i need to pass return values. $result = mysql_query("UPDATE into categories WHERE c_name = '$...

MediaWiki: how to get the last N edited articles by a user?

Using PHP and MySQL, I am integrating a site with a wiki based on MediaWiki, so that profiles of users in the site have some stats about their contributions in the wiki. I want to show the last 3 edited articles of a user in a namespace (the main one, id 0), without repeating, and the links to them. In order to do that, I do more or l...

Apache error [notice] Parent: child process exited with status 3221225477 -- Restarting.

Hi, I'm using PHP5, CodeIgniter and Apache. The localhost php pages were loading fine and then suddenly they started crashing Apache. The web pages seem to get to different stages of loading when apache crashes. The only interesting line in the Apache error log file says : [notice] Parent: child process exited with status 3221225477...

how can I add key value pairs to an array?

how can I add key value pairs to an array? This won't work: public function getCategorieenAsArray(){ $catList = array(); $query = "SELECT DISTINCT datasource_id, title FROM table"; if ($rs=C_DB::fetchRecordset($query)) { while ($row=C_DB::fetchRow($rs)) { if(!empty($row["title"])){ ...

How can I get the last ten rows in a Mysql database table ?

hi I use this $query = "SELECT * FROM info ORDER BY id DESC limit 10"; $result = @mysql_query( $query ); $row = mysql_fetch_array($result); print_r($row); but it gets just the last row ...

Question on a variable passed to query.

function add_new($father = 0 , $chName, $desc , $icon ) // add new category { $position = $this->get_position($father); $sql = "INSERT into ".$this->table_name."(position,c_name,c_desc,c_icon,c_group) VALUES('','".$chName."','".$desc."','".$icon."','".$this->Group."')"; mysql_query($sql) or die(trigger_error("<br><storng><u>MySQ...

Conditional operator with only true statement

I want to set a variable to a value, but only if a condition is true. Instead of doing the following: if($myarray["foo"]==$bar){ $variablename=$myarray["foo"]; } This can end up being quite long if the variable names are long, or perhaps it involves arrays, when it's quite simple what I want to do set a value if a condition ...

mysql_insert_id help

$position .= mysql_insert_id(); $sql = "UPDATE ".$this->table_name." SET position = '".$position."' WHERE id = '".mysql_insert_id()."'"; When i return $position i get two values 150 and 151. That is current row ID and previous or selected row ID. I just need the previous ROW ID.When i look into my DB i have two values 150151...

Decoding query strings in PHP

Okay, so I've written a REST API implementation using mod_rewrite and PHP. I'm accepting a query string via the body of HTTP DELETE requests (... collective groan?). Arguments about the wisdom of both previous statements aside, what I've found is that PHP doesn't automatically parse the request body of DELETE requests (i.e. $_POST is e...

Is there a difference between !== and != in PHP?

Is there a difference between !== and != in PHP? ...

wowarmory.com API help

I'm developing a simple application that fetches some data from wowarmory.com. What I need to do is fetch reputations for a character. I know where's the api located: http://www.wowarmory.com/character-reputation.xml?r=Realm&amp;cn=CharacterName I can fetch the XML and load it into the SimpleXML object but I'm having trouble figuring ...

PHP Cookie Security Question

I have the following code that is presenting a 'word-of-the-day', As I am relatively new to php coding, I wanted to make sure that there weren't any security issues for how I am selecting from my database from the cookie value. Thanks. if ($word_of_the_day) { $wotd = $wpdb->get_results("SELECT term,definition FROM glossary WHERE ter...

How to test controllers with CodeIgniter?

I have a PHP web application built with CodeIgniter MVC framework. I wish to test various controller classes. I'm using Toast for unit testing. My controllers have no state, everything they process is either saved into session or passed to view to display. Creating a mock session object and testing whether that works properly is straight...