f



How to debug PHP's mysql_query() function?

Hi

I posted three days ago about a function I wrote which kept refusing
to run a mysql_query.

Well I did away with the function, and hard coded the variables into
the query itself. Here's what I have now:

mysql_query("UPDATE about SET category_id = 58 WHERE about_id = 5") or
die('error: ' . mysql_error());

Just running mysql_query, with no logic,  I still dont get an update,
and the script doesn't die. What other things should I be looking at?

Here's another variation of the same thing I've tried:

mysql_query("UPDATE about SET category_id=60 WHERE about_id=5") or
trigger_error("SQL", E_USER_ERROR);

I've also done: $update = mysql_query("Blah blah blah"); and testing
$update gives me nothing. No errors, no update.

Thanks,

J Moore
0
nobody5144 (16)
11/2/2005 6:39:31 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

7 Replies
526 Views

Similar Articles

[PageSpeed] 31

John Moore said the following on 02/11/2005 18:39:
> Hi
> 
> I posted three days ago about a function I wrote which kept refusing
> to run a mysql_query.
> 
> Well I did away with the function, and hard coded the variables into
> the query itself. Here's what I have now:
> 
> mysql_query("UPDATE about SET category_id = 58 WHERE about_id = 5") or
> die('error: ' . mysql_error());
> 
> Just running mysql_query, with no logic,  I still dont get an update,
> and the script doesn't die. What other things should I be looking at?

Without seeing the function, it's difficult to say!

Have you tried getting the function to echo the query string that it 
creates, and comparing that to what you expect?


-- 
Oli
0
catch (918)
11/2/2005 7:09:25 PM
John Moore (nobody@nomail.com) wrote:
: Hi

: I posted three days ago about a function I wrote which kept refusing
: to run a mysql_query.

: Well I did away with the function, and hard coded the variables into
: the query itself. Here's what I have now:

: mysql_query("UPDATE about SET category_id = 58 WHERE about_id = 5") or
: die('error: ' . mysql_error());

Are you sure you have a record with about_id = 5?  It is not an error to
update zero rows.  A successful update of zero rows is documented to
return TRUE from mysql_query.

You need to check the row count after running the query.

But I don't have an example handy of doing that, so you'll have to look it
up.  I suspect that google can find examples of php mysql updates and
checking the row count afterwards.


--

This programmer available for rent.
0
yf110 (571)
11/2/2005 7:16:30 PM
On Wed, 02 Nov 2005 19:09:25 GMT, in comp.lang.php Oli Filth
<catch@olifilth.co.uk> wrote:


>
>Without seeing the function, it's difficult to say!
>
>Have you tried getting the function to echo the query string that it 
>creates, and comparing that to what you expect?

Like I said, I got rid of the function. Now I'm just dealing with this
snippet of code which won't execute:

mysql_query("UPDATE about SET category_id=63 WHERE about_id=5") or
trigger_error(mysql_error(), E_USER_ERROR);

I'm running it exactly like that.

I also tried it like this:

      $update = mysql_query("UPDATE about SET category_id=63 WHERE
about_id=5") or trigger_error(mysql_error(), E_USER_ERROR);
      if (!$update) {
        echo 'Error: ' . mysql_error();
      }
      echo '<hr>Info: ';
      mysql_info($update);
      echo '<hr>';

mysql_info returns a warning:

Warning: mysql_info() expects parameter 1 to be resource, boolean
given in c:\Path\to\script.php  on line 384

Thanks,

J Moore
0
nobody5144 (16)
11/2/2005 7:26:38 PM
John Moore wrote:

> 
>       $update = mysql_query("UPDATE about SET category_id=63 WHERE
> about_id=5") or trigger_error(mysql_error(), E_USER_ERROR);
>       if (!$update) {
>         echo 'Error: ' . mysql_error();
>       }
>       echo '<hr>Info: ';
>       mysql_info($update);
>       echo '<hr>';
> 
> mysql_info returns a warning:
> 
> Warning: mysql_info() expects parameter 1 to be resource, boolean
> given in c:\Path\to\script.php  on line 384
> 

Well, you're running it on MS-Windows - thats not good for starters.

Try switching on the replication log in mysql and see if it changes size /
timestamp when you run the query (you can also convert the log to a
readable format - RTFM for more details).

mysql_info(), like all the mysql_ fns should use the default...according to
the manual (same for both _info & _query):

: If by chance no connection is found or established, 
: an E_WARNING level warning is generated.

....but of course you read that already. It seems most peculiar that the
script is getting that far the way you've written it (the connection exists
at line 1, becuase you're not getting a fatal error, yet nothing is
(allegedly) getting updated, then there is no connection at line 5. I guess
your installation might be fscked.

C.


0
11/2/2005 9:04:54 PM
On 2 Nov 2005 12:16:30 -0700, in comp.lang.php
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:

>
>Are you sure you have a record with about_id = 5?  It is not an error to
>update zero rows.  A successful update of zero rows is documented to
>return TRUE from mysql_query.
>
>You need to check the row count after running the query.
>
>But I don't have an example handy of doing that, so you'll have to look it
>up.  I suspect that google can find examples of php mysql updates and
>checking the row count afterwards.

Well thanks for trying. I will try your suggestion for checking the
row count.

Maybe it will help if I put this into some context. 

In this script there are 5 queries, and the third one refuses to run
or kill the script. I've tested this over and over, within a function
and outside of the function. I've done var_dumps and echoed out the
queries and variables at every step of the script, but still the third
query refuses to run.

It's a simple update query which works perfectly at the command line:

UPDATE about SET category_id=65 WHERE about_id=5;

Here it is in the context of my current version of the script:

// create the category
$cat_name = $_SESSION['cat_name'];
$insert_query = "INSERT INTO about_category (category_id, cat_name,
total_pages) VALUES ('', '$cat_name', 0)";
$insert_result = mysql_query($insert_query) or die(mysql_error());

// get the new category_id
$select_query = "SELECT category_id AS new_id FROM about_category
WHERE cat_name ='$cat_name'";
$select_result = mysql_query($select_query) or die(mysql_error());
$new_id = mysql_result($select_result, 0, 'new_id');

// This is the query that refuses to run
// update the page
$update_sql = "UPDATE about SET category_id=65 WHERE about_id=5";
$update_result = mysql_query($update_sql) or die(mysql_error());

// update the category totals
include_once('inc/about_inc2.php');
update_cat_total('remove', $_SESSION['category_id']);
update_cat_total('add', $new_id);

I have this written as a set of procedures without any logic because I
thought it would be easier to see why the third query won't run. Once
I get this bug fixed I'll go back and add some logic to test all the
results, and put the code back into a function.

Here is the layout of the two tables; about and about_category:

CREATE TABLE about (
  about_id int(10) unsigned NOT NULL auto_increment,
  category_id int(10) unsigned NOT NULL default '0',
  name varchar(35) NOT NULL default '',
  display enum('show','hide') NOT NULL default 'show',
  text text NOT NULL,
  meta_data_id int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (about_id)
) TYPE=MyISAM;

CREATE TABLE about_category (
  category_id int(10) unsigned NOT NULL auto_increment,
  cat_name varchar(35) NOT NULL default '',
  total_pages tinyint(3) unsigned NOT NULL default '0',
  PRIMARY KEY  (category_id)
) TYPE=MyISAM;

Also, the final two updates take place in another function, which
works every time:

function update_cat_total($task, $category_id) {
  // get the current count for total pages
  $query = "SELECT total_pages FROM about_category WHERE category_id =
'$category_id'";
  $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
  if ($result) {
    $total_pages = mysql_result($result, 0, 'total_pages');
    // $task may be 'add' or 'remove'
    switch ($task) {
      case 'add':
        $expression = $total_pages + 1;
        break;
      case 'remove':
        if ($total_pages > 0) {
          $expression = $total_pages - 1;
        }
        else {
          $expression = 0;
        }
        break;
    }

    $query = "UPDATE
                about_category
              SET
                total_pages = $expression
              WHERE
                category_id = '$category_id'";

    $result = mysql_query($query) or trigger_error("SQL",
E_USER_ERROR);

    if ($result) {
      return true;
    }
    else {
      return false;
    }
  }
  else {
    die('<hr>No result from query: ' . $query . ' Error: ' .
mysql_error() . '<hr>');
  }
}

I may not be able to code php very well, but I make a damn good plate
of spaghetti.


J Moore
0
nobody5144 (16)
11/2/2005 9:15:37 PM
On Wed, 02 Nov 2005 21:04:54 GMT, in comp.lang.php Colin McKinnon
<colin.thisisnotmysurname@ntlworld.deletemeunlessURaBot.com> wrote:


>
>Well, you're running it on MS-Windows - thats not good for starters.
>

Thanks, but it behaves the same way in Slackware9.1, PHP 4.3.2,
mysql4.0.13, Apache1.3.24

>Try switching on the replication log in mysql and see if it changes size /
>timestamp when you run the query (you can also convert the log to a
>readable format - RTFM for more details).
>
>mysql_info(), like all the mysql_ fns should use the default...according to
>the manual (same for both _info & _query):
>
>: If by chance no connection is found or established, 
>: an E_WARNING level warning is generated.
>
>...but of course you read that already. It seems most peculiar that the
>script is getting that far the way you've written it (the connection exists
>at line 1, becuase you're not getting a fatal error, yet nothing is
>(allegedly) getting updated, then there is no connection at line 5. I guess
>your installation might be fscked.
>
>C.
>

This gives me something to go on- I really appreciate it and will
check it out.


J Moore
0
nobody5144 (16)
11/2/2005 9:20:28 PM
John Moore wrote:
> Hi
> 
> I posted three days ago about a function I wrote which kept refusing
> to run a mysql_query.
> 
> Well I did away with the function, and hard coded the variables into
> the query itself. Here's what I have now:
> 
> mysql_query("UPDATE about SET category_id = 58 WHERE about_id = 5") or
> die('error: ' . mysql_error());
> 
> Just running mysql_query, with no logic,  I still dont get an update,
> and the script doesn't die. What other things should I be looking at?
> 
> Here's another variation of the same thing I've tried:
> 
> mysql_query("UPDATE about SET category_id=60 WHERE about_id=5") or
> trigger_error("SQL", E_USER_ERROR);
> 
> I've also done: $update = mysql_query("Blah blah blah"); and testing
> $update gives me nothing. No errors, no update.

after the query, run something like:
$rows = mysql_affected_rows()

if var_dump(mysql_query(...)) shows boolean true, then the query was a 
success, then if $rows > 0, something was changed in the database, if 
-1, the query failed, and 0 indicates a successful query with nothing 
updated. if 0, perhaps the row already had those values or no rows have 
the about_id = 5...

Also, I have a tendency to include the link identifier when using the 
database functions just so that I know exactly which connection I am 
working with (even if there is only one in the script) - it just removes 
some more unknowns for debug time.

-- 
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
0
justin4335 (310)
11/2/2005 10:38:16 PM
Reply:

Similar Artilces:

Is Php built in function ' imagecreate()' compatible in Php version 5.2.2 ?
Hi All, I have the php version 5.2.2 . When I am using " $im = imagecreate(......); " I am getting the following message "Fatal error: Call to undefined function imagecreate() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\server.php on line 32" I want to know whether "imagecreate()" is compatible in PHP version 5.2.2.? saikiran.iitkgp@gmail.com wrote: > Hi All, > > I have the php version 5.2.2 . When I am using > > > " $im = imagecreate(......); " I am getting the following message > > > "Fatal error: Call to undefined function imagecreate() in C:\Program > Files\Apache Software Foundation\Apache2.2\htdocs\server.php on line > 32" > > > I want to know whether "imagecreate()" is compatible in PHP version > 5.2.2.? > It looks like you're missing the gd extension. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== edit php.ini ;extension=php_gd2.dll to extension=php_gd2.dll ...

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
I installed PEAR HTTP_Upload to my new server and now im getting this error when runnign the script. any help? Maximus wrote: > I installed PEAR HTTP_Upload to my new server > and now im getting this error when runnign the script. > > > any help? > permissions problem? where is DB.php located? does DB.php reside in the include_path directories? The message is self explanatory. -- Michael Austin. DBA Consultant Donations welcomed. Http://www.firstdbasource.com/donations.html :) Try on your command line as root: >pear install DB Alex http://prepared-statement.blogspot.com ...

why does $_SERVER['PHP_SELF'] say /test.php/test.php for test.php?
I have a PHP script at 127.0.0.1/test.php. It's contents are as follows: <?php echo $_SERVER['PHP_SELF']; ?> And it's output isn't test.php, as I'd expect, or /test.php, but rather, /test.php/test.php. Why? And how do I fix it? El 06/10/2010 6:53, yawnmoth escribi�/wrote: > I have a PHP script at 127.0.0.1/test.php. It's contents are as > follows: > > <?php > echo $_SERVER['PHP_SELF']; > ?> > > And it's output isn't test.php, as I'd expect, or /test.php, but > rather, /test.php/test.php. Why? And how do I fix it? What output do you get if you change it to this? <?php echo '[' . $_SERVER['PHP_SELF'] . ']'; ?> What do your other $_SERVER values look like? <?php print_r($_SERVER); ?> -- -- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programaci�n web: http://borrame.com -- Mi web de humor satinado: http://www.demogracia.com -- On 06/10/10 09:30, "�lvaro G. Vicario" wrote: > El 06/10/2010 6:53, yawnmoth escribi�/wrote: >> I have a PHP script at 127.0.0.1/test.php. It's contents are as >> follows: >> >> <?php >> echo $_SERVER['PHP_SELF']; >> ?> >> >> And it's output isn't test.php, as I'd expect, or /test.php, but >> rather, /test.php/test.php. Why? And how do I fix it? > > What output do you get if you change it ...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Program Files\PHP\pear;F:\www \include" ,it looks all right,was there anything I have missed in the config file?Or something wrong ? Wish somebody can help me out. Thanks, Mikay >Warning: require_once(PEAR.php) [function.require-once]: failed to >open stream: No such file or directory in F:\Program Files\PHP\PEAR >\Text\CAPTCHA.php on line 22 >Fatal error: require_once() [function.require]: Failed opening >required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files >\PHP\PEAR\Text\CAPTCHA.php on line 22 So where is the pear.php file? >It appears that it cann't find the pear.php ,but i checked my dir,and >this file was there,and also I have my php.ini file checked,the >include_path=include_path=".;F:\Program Files\PHP\pear;F:\www >\include" ,it looks all right,was there anything I have missed in the >config...

i need an equivalent to PHP's array_unique function
The PHP scripting language has the array_unique() function that gets the unique, non-redundant values out of an array. Does Javascript have anything similar? lkrubner@geocities.com wrote: > The PHP scripting language has the array_unique() function that gets > the unique, non-redundant values out of an array. > > Does Javascript have anything similar? The short answer is no, but there's a few ways around it. If you use an Object as a pretend associative array you can either iterate once through the array and put each element into the associative array and get a unique list (but it won't be guaranteed to be in the same order as the indexed array, using the for..in statement). You could also just use an "associative array" to start with, instead of an array. If you care about order, you could add the data to both an associative array and the indexed array, and use the associative array to quickly check if the data already exists before adding it to the arrays. Jc wrote: > lkrubner@geocities.com wrote: > >>The PHP scripting language has the array_unique() function that gets >>the unique, non-redundant values out of an array. >> >>Does Javascript have anything similar? > > > The short answer is no, but there's a few ways around it. > > If you use an Object as a pretend associative array you can either > iterate once through the array and put each element into the > associative array ...

php's mail() function // permission problems
Hi all. I'm trying to get php's mail() function working. When I use it at the moment, I get: /var/log/messages: Jul 14 13:23:27 mail sendmail[22171]: NOQUEUE: Milter (mimedefang): to error state /usr/local/apache2/logs/error_log: Program mode requires special privileges, e.g., root or TrustedUser. I have checked in the PHP newsgroups, and they assure me it is a problem with my sendmail setup... I have installed sendmail (8.12.8) as per included instructions and read the SECURITY file. The following permissions set: -r-xr-sr-x 1 root smmsp 611974 Mar 5 21:37 /usr/...

Why are these so brilliantly hidden when it comes to PHP's functions...?
I was reading the following article yesterday: http://www.talkphp.com/vbarticles.php?do=article&articleid=41&title=using-the-internal-array-pointers-to-access-elements-in-arrays What struck me while reading it was how very little we hear about the array internal pointers !! I've been in PHP now for a good 2 years, and I've never heard these little guys mentioned before. My question is... what do you use internal pointers for, and why? adam.timberlake@gmail.com wrote: > I was reading the following article yesterday: > http://www.talkphp.com/vbarticles.php?do=article&articleid=41&title=using-the-internal-array-pointers-to-access-elements-in-arrays > > What struck me while reading it was how very little we hear about the > array internal pointers !! I've been in PHP now for a good 2 years, > and I've never heard these little guys mentioned before. > > My question is... what do you use internal pointers for, and why? > Answered in alt.lang.php. And please crosspost - don't multipost! -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== On Fri, 04 Jan 2008 14:25:28 +0100, <adam.timberlake@gmail.com> wrote: > I was reading the following article yesterday: > http://www.talkphp.com/vbarticles.php?do=3Darticle&articleid=3D41&titl= e=3Dusing-the-internal-array-pointers-to-access-elements-in-a...

php function to format date's time
Hi, I am retrieving results from an SQL query, one of which is a date $arrival = $row['itin_arrival_day']; I would like to write a PHP function that formats the date in the following way: If the time part of the date is of the form 2006-05-19 00:00:00 in which the time is midnight, I would like the result to be printed as "05/19/06 ---" but if the time is anything other than midnight, for example, "2006-05-21 18:00:00" I would like the printed result to be "05/21/06 6:00 PM". How can I do this? - Dave laredotornado@zipmail.com wrote: > Hi, > > I am retrieving results from an SQL query, one of which is a date > > $arrival = $row['itin_arrival_day']; > > I would like to write a PHP function that formats the date in the > following way: > > If the time part of the date is of the form 2006-05-19 00:00:00 in > which the time is midnight, I would like the result to be printed as > "05/19/06 ---" but if the time is anything other than midnight, for > example, "2006-05-21 18:00:00" I would like the printed result to be > "05/21/06 6:00 PM". > > How can I do this? - Dave > Untested and probably not the most efficient, but should work: $arrival_array = explode( ' ', $arrival ); // format the date $date_array = explode( '-', $arrival_array[0] ); $arrival_date = $date_array[1] . '/...

What's wrong with header = ('location: pagename.php') ?
I'm sorry if this turns out to be a double post but I got an error during the first attempt. I'm perplexed at the error in the header = ('location: index.php'); I have used this before successfully but this time the syntax checker at http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/ issues this message: Parse error: parse error, unexpected '=' in quickform.php on line 48. 48: header = ('location: index.php'); Could someone please point me in the right direction? Thank you! - tim <?php session_start(); error_reporting(E_ALL); $to = "tim@website.com"; $subject = "Quick Form"; $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: $emailaddress\r\n"; $today_mm = date("M"); $today_dd = date("j"); $today_yyyy = date("Y"); $today = $today_mm." ".$today_dd.", ".$today_yyyy; $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $name = $_POST['firstname']." ".$_POST['lastname']; $homephone = $_POST['homephone']; $workphone = $_POST['workphone']; $time2contact = $_POST['time2contact']; $emailaddress = $_POST['emailaddress']; $propertyaddress = $_POST['propertyaddress']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST[...

including a PHP file displays the file's content to the user agent (PHP 5.1)
Hi all I'm having a strange problem when upgrading the content management system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to i18n are included with the "include" function, but they are being displayed to the user agent instead of being parsed by PHP. With PHP 4.4 there was no problem. You can download a test script from: http://blog.kristofcoomans.be/wp-content/uploads/test.tar Thanks for your help Cheers -- Kristof Cyberwolf wrote: > Hi all > > I'm having a strange problem when upgrading the content management > system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to > i18n are included with the "include" function, but they are being > displayed to the user agent instead of being parsed by PHP. With PHP > 4.4 there was no problem. > > You can download a test script from: > http://blog.kristofcoomans.be/wp-content/uploads/test.tar > > Thanks for your help > > Cheers > > -- > > Kristof Do any other php pages parse properly? If not, then it will most likely be a problem with your install and/or configuration. If you can parse some php pages, it might be worth checking your PHP 5 configuration, and then Apache's configuration if nothing jumps out at you in there. Is there any particular reason you chose to go with PHP 5? I have heard of lots of people having problems with it, which is why I stay away from it. Well, until I understand it a bit better...

HELP!! PHP Warning: PHP Startup: Unable to load dynamic library 'c:\PHP\Ext\php_mysql.dll'
Why do I keep getting this error mesgage on my phpinfo() page trying to get PHP and MySQL to communicate? I am running this in IIS. Here's what I have - My php.ini resides in my C:\WINNT directory. In it, I have removed the ';' from the extension=php_mysql.dll. Also in the php.ini file I set extension_dir = c:\PHP\Ext In c:\PHP\Ext I have the following files: libmysqli.dll libmySQL.dll php5apache2.dll (Do I need this since I am using IIS)? php5ts.dll php_mysql.dll Any help would be tremendously appreciated. I have spent a ton of time on this. Thanks. MS wrote: > Why do I keep getting this error mesgage on my phpinfo() page trying to > get PHP and MySQL to communicate? I am running this in IIS. > > Here's what I have - > > My php.ini resides in my C:\WINNT directory. In it, I have removed the > ';' from the extension=php_mysql.dll. > > Also in the php.ini file I set extension_dir = c:\PHP\Ext > > In c:\PHP\Ext I have the following files: > > libmysqli.dll > libmySQL.dll > php5apache2.dll (Do I need this since I am using IIS)? > php5ts.dll > php_mysql.dll > > Any help would be tremendously appreciated. I have spent a ton of time > on this. > > Thanks. Hi, A few common mistakes are: 1) editting the wrong php.ini Ask phpinfo() which php.ini it is using. Often people edit the one in c:\php\php.ini. My advise: delete all on your system except one. 2) forget to giv...

Error while obtaining sizes from MEX S-function 'forward' in block 'dummy/Dynamic_Model/S-Function'. MATLAB error message:.
Hi to everybody, I created the file forward.dll using the command: mex -DWIN32 -output forward model_d.c model_s.c sdlib.c assigns.c contact.c derivs.c gmc.c impact.c inits.c invert.c lcp_solver.c lmdif_c.c mathtools.c object.c output.c pipetools.c readmuscles.c readtools.c sdfor.c spring_based.c wrapping.c gcvspl.c user_def.lib forward.lib acpp.lib qhull.lib solid.lib wrap.lib I need to run the command: set_param([subsystemname,'/','S-Function'],'function name','forward','parameters','[0],[0],[0],[0],[0],[0],[1 0 0 0 20],[0]'); ...

Any report formatting function for PHP similar to perl's Format?
Different languages have their place and for web/interactive work I just love PHP. I have a project where I need to product a multitide of reports that will first display with an option to send to the printer. While I normally use sprintf I have run into issues with heavy columnarized report output. Any one familiar with the format feature of perl... are you aware of anything similar to it for php? Any suggestions appreciated - B On Jun 16, 1:39=A0pm, bobmct <bo...@worthless.info> wrote: > Different languages have their place and for web/interactive work I > just ...

Output returned by S-function 'xxxxxxx' in 'xxxxx/S-Function' during flag=3 call must be a real vector of length 1
Hi there, I've found several posts where people are experiencing this error "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during flag=3 call must be a real vector of length 1" but I haven't been able to access a definitive solution. My m-files ran successfully with my previously installed version of Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a and now see this error. in InitializeSizes(u): sizes.NumOutputs = 1; sizes.NumInputs = 2; in Output(t,u): if u(2) == 0 u(2) = 1; end sys = u(1)/u(2); Does anyone have any hints? Is there a new syntax? cheers, Mel "Mel Cutler" <melcinasia@yahoo.co.nz> wrote in message news:iq7t6t$2ld$1@newscl01ah.mathworks.com... > Hi there, > > I've found several posts where people are experiencing this error > "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during > flag=3 call must be a real vector of length 1" but I haven't been able to > access a definitive solution. > > My m-files ran successfully with my previously installed version of > Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a > and now see this error. > > in InitializeSizes(u): > sizes.NumOutputs = 1; > sizes.NumInputs = 2; > > in Output(t,u): > if u(2) == 0 > u(2) = 1; > end > sys = u(1)/u(2); > > Does anyone...

No tutorials/examples to be found on using PHP dbm-style functions with apache's mod_auth_db
Hi In a project I'm working on I need to allow users to register themselves on a site, and then give them access to a protected folder of the site once they are validated. I'll be running Apache and PHP on some form of Unix. I can't use PHP sessions to control access because there will be lots of other file types besides .php in the protected folder. I can't use simple basic authentication because users need to be added automatically, not manually, and besides i think the flat file nature of basic auth will cause problems beyond a few hundred users (we need to sup...

when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit
Below is my code: But when I receive the mail, I don't get the last two digits in the $post_url. I tried displaying the same message on the page and it displayes $post_url properly. But when I receive the mail, I get the value of $post_url as www.32minutesforum.com/post_clicked.php?id$. where as I should get www.32minutesforum.com/post_clicked.php?id<some number>. i.e. www.32minutesforum.com/post_clicked.php?id15 Please help! File: <?php include 'connect.php'; include 'header.php'; echo '<div class="holder_content">'; echo '<section class="group_text">'; echo 'Posted successfully. Check your post <a href="'.$_SESSION['reply_post_id'].'">HERE</a>'; $post_url = $_SESSION['reply_post_id']; $to= $_SESSION['post_email']; $subject="You just got a reply for your post in 32minutesforum.com"; $message=' <html> <head> <title>32 Minutes Forum</title> </head> <body> <p>You got a reply for your post title: '. $_SESSION['post_title'].'.</p> <p>Check your post in:<br/>www.32minutesforum.com/'.$post_url.'.</p> <p>Thanks for using 32minutesforum.com.<br/> Thank you,<br/> 32minutesforum.com Team.</p> </body> </html>'; ...

PHP-MySQL 'Unknown Function' Error
I'm running a small Web server. I use RH 9.0 (Enterprise), Apache, MySQL, and PHP (all versions that came with the RH CD). The Web server is working OK, but I'm having a problem when I try to use PHP to access a MySQL Database. When I execute "mysql_connect('host','user','password')" I get an error message that this is an unknown function. The script then stops executing and an empty page is returned to the client. PHP seems to be working (it will execute phpinfo() without any problems). MySQL seems to be working (I can use the MySQLAdmin o...

Does php has any function like 'alert()' in javascript ?
Does php has any function like 'alert()' in javascript ? I want a popup window to display a message in php. pradnya wrote: > Does php has any function like 'alert()' in javascript ? > I want a popup window to display a message in php. PHP runs on the server in almost all cases. Do you want a popup on the server? If you want PHP to alert something, simply use the ouput PHP sends back to the browser. Erwin Moller On Dec 12, 10:16 am, pradnya <pdu...@gmail.com> wrote: > Does php has any function like 'alert()' in javascript ? > I want a popup window to display a message in php. <?php echo ('<script type="text/javascript">alert ("boo!");</script>'); ?> Gordon wrote: > On Dec 12, 10:16 am, pradnya <pdu...@gmail.com> wrote: >> Does php has any function like 'alert()' in javascript ? >> I want a popup window to display a message in php. > > <?php > echo ('<script type="text/javascript">alert ("boo!");</script>'); > ?> Loved this one. LOL! ...

PHP create HTML email inserts '!'s
OK, I'm trying to create an email and when it sends the email, it mostly works except that there are '!' inserted at some spots. Checking the html source of the email, looks like they are placed at the end of long lines. I'm assuming there is some issue with the encoding, but searching through groups, nothing I've tried has worked. Can someone let me know if I should be doing something differently with my headers for an html email? I'll change emails to null@null.com. Thanks! $headers = "X-Mailer: PHP " . phpversion() . "\r\n"; $headers .= "From: null@null.com\r\n"; $headers .= "Reply-To: null@null.com\r\n"; $headers .= "Content-Type: text/html;\r\n"; $headers .= "charset=\"iso-8859-1\"\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; Hello, on 02/07/2007 05:03 PM geek7 said the following: > OK, > > I'm trying to create an email and when it sends the email, it mostly > works except that there are '!' inserted at some spots. Checking the > html source of the email, looks like they are placed at the end of > long lines. I'm assuming there is some issue with the encoding, but > searching through groups, nothing I've tried has worked. Can someone > let me know if I should be doing something differently with my headers > for an html email? I'll change emails to null@null.com. Thanks! > > $headers = &...

Using preg_replace to convert '<?php*?>' to nothing (removing all PHP code)
Hi, I am trying to use preg_replace to take out all occurances of PHP code after reading (fread()) the contents of a PHP file. The code I am using is: $html = preg_replace("<?php*?>", "", $html); Unfortuntely it is not working and giving the following error: Warning: preg_replace(): Nothing to repeat for offset 0 in C:/apache/... Can someone please try this out and see what they get. How can I get this to work? Cheers Burnsy On 2 Sep 2005 13:57:49 -0700, bissatch@yahoo.co.uk wrote: >I am trying to use preg_replace to take out all occurances of PHP code >after reading (fread()) the contents of a PHP file. The code I am using >is: > >$html = preg_replace("<?php*?>", "", $html); OK, what do you think that expression should match, and why? -- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool Do you get the same error if you switch out <?php*?> with something simple, as a test? > $html = preg_replace("<?php*?>", "", $html); To my basic knowledge, that expression should match a string with '<?php' at the start, and '?>' at the end with any collection of characters inbetween (represented by the asterix - * - character). > Do you get the same error if you switch out <?php*?> with something simple, as a test? I did try and switch the '<?php*?>...

How to call a component's callback function in another component's callback function
How to call a component's callback function in another component's callback function? I want to call popup menu's call back function in push button's call back function. What should I do and how? I will be grateful to you for you help! Thank you, Regards, Ahmed Just call it like you would any other function. The only thing you have to worry about is parsing arguments in the callback that is called from multiple sources. This example illustrates the difference: %---------------------------------------------------------------------------------------% function [] = call...

How to add the solver's option in Simulink's s-function
I have a system described in differential equations and I have include the options in the differential equation solving, and I incorporated it in the s-function block and put it in the Simulink. Here are my options and ode solver options = odeset ('Mass',@xu_mass,'MassSingular','yes','MStateDependence','strong'); % odeset('MaxStep','1e-3'); % odeset('RelTol',1e-3,'AbsTol',1e-3); domain = 0:1e-4:8; [t,y]=ode23(@xu_eq,domain,[0;zeros(7,1)],options); However, I don't know where to add the options to the simulation. Please help. Thanks in advance! On 2=D4=C27=C8=D5, =C9=CF=CE=E710=CA=B120=B7=D6, workaholic <liua...@gmail.= com> wrote: > I have a system described in differential equations and I have include > the options in the differential equation solving, and I incorporated > it in the s-function block and put it in the Simulink. > > Here are my options and ode solver > options =3D odeset > ('Mass',@xu_mass,'MassSingular','yes','MStateDependence','strong'); > % odeset('MaxStep','1e-3'); > > % odeset('RelTol',1e-3,'AbsTol',1e-3); > domain =3D 0:1e-4:8; > [t,y]=3Dode23(@xu_eq,domain,[0;zeros(7,1)],options); > > However, I don't know where to add the options to the simulation. > Please help. > > Thanks in advance! Is there anyone who met such a problem? Thanks again in...

PHP not compiling
Hello all, I would appreciate any help regarding this problem because I'm at a complete loss. I'm trying to compile PHP 4.4.1 on RH E3 ES. I need to enable zlib support but when I do PHP does not compile without errors. Here's what I did. make clean; ../configure --with-apxs2=/usr/sbin/apxs --with-mysql=/usr --with-config-file-path=/etc --enable-mbstring=all --with-zlib=/usr make; make: *** [libphp4.la] Error 1 If I run configure without --with-zlib=/usr it compiles just fine. So it is definitly zlib that's causing the error. What's weird though is that the error seems to come from mysql! The full error log is included below. I'm using MySQL 4.1 compiled from source. (It works fine.) Any help or suggestions would be very much appreciated!!! Thanks, Balazs /usr/lib/mysql/libz.a(adler32.o)(.text+0x0): In function `adler32': : multiple definition of `adler32' /usr/lib/mysql/libz.a(adler32.o)(.text+0x0): first defined here /usr/lib/mysql/libz.a(adler32.o)(.text+0x250): In function `adler32_combine': : multiple definition of `adler32_combine' /usr/lib/mysql/libz.a(adler32.o)(.text+0x250): first defined here /usr/lib/mysql/libz.a(compress.o)(.text+0x0): In function `compress2': : multiple definition of `compress2' /usr/lib/mysql/libz.a(compress.o)(.text+0x0): first defined here /usr/lib/mysql/libz.a(compress.o)(.text+0xb0): In function `compress': : multiple definition of `compress' /usr/lib/mysql/libz.a(compre...

confused
Hello everybody. I'm looking for PHP API function for 'die' I'm messing with my own function - it's my own 'var_dump' - 'myDump' It works fine, but I want to end script after dumping variables. I found that Zend's lexer return T_EXIT token and creates zend_do_exit code - but I guest it's not what I need. So the question is: How can I end script from PHP API? I want to achieve exactly the same effect as: --- myDump($object); die(); --- but I want it all in one function as: --- myDump($object); --- thanx in advance cheers R R wrote: > Hello everybody. > > I'm looking for PHP API function for 'die' > > I'm messing with my own function - it's my own 'var_dump' - 'myDump' > > It works fine, but I want to end script after dumping variables. > > I found that Zend's lexer return T_EXIT token and creates zend_do_exit > code - but I guest it's not what I need. > > So the question is: > How can I end script from PHP API? I want to achieve exactly the same > effect as: > > --- > myDump($object); > die(); > --- > > but I want it all in one function as: > --- > myDump($object); > --- > > thanx in advance > cheers R > R, Why wouldn't you just call exit() from within your function? function myDump($object) { //do something with object... exit(); } Carl. Carl wrote: > Why wouldn'...

Web resources about - How to debug PHP's mysql_query() function? - comp.lang.php

$result = mysql_query($strSql); foreach($bestmatch_array as $restaurant) - Pastebin.com
PASTEBIN - #1 paste tool since 2002 create new paste shop new! tools api archive faq PASTEBIN create new paste trending pastes sign up login ...

SQL injection - Wikipedia, the free encyclopedia
SQL injection is a technique often used to attack databases through a website. This is done by including portions of SQL statements in a web ...

Business Industry & Education Australia
Industry Category : Select a industry category Warning : mysql_query() [ function.mysql-query ]: Access denied for user 'bieacom'@'localhost' ...

, Web Design Articles & Inspiration, Social Marketing, SEO, Design Feeds
Design Feeds is your portal to the latest design articles collected from a variety of sources.

New Brunswick > trans palace Search Archive
Warning : mysql_query() [ function.mysql-query ]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hom ...

php过滤提交数据 防止sql注入攻击_安全_IT专家网 安全子站
安全子站面向安全专业人员和企业,立足安全领域的最前沿。由专家为您提供企业安全解决方案、病毒及恶意程序攻防策略、系统及网络安全技巧、最新安全工具及产品推介、安全政策和法规向导、安全认证指南、安全管理技巧、每周安全工作计划、职业生涯规划、安全趣闻及书籍推介。此外,还为您搜罗和发布企业安全白皮书,内容涉及安全产品(VPN ...

select * from wg_article a left join wg_article_field b on (a.id=b.aid) where id= and isshow=1 limit ...
34. $this -> arrSql [] = $sql ; 35. if( $result = mysql_query ( $sql , $this -> conn ) ){ 36. return $result ; 37. }else{ 38. if( mysql_error ...

Broken link
Warning : mysql_query() [ function.mysql-query ]: Unable to save result set in /home/aceshow/public_html/php/l3_celeb_detail.php on line 46 ...

All Publicists - Find a publicist for your next publicity job
AllPublicists helps companies find best publicists and obtain publicity for their products and services.

Pastebin « AndrewNohawk
Sorry guys, I noticed that I haven’t been getting any pasteLert updates, and i just realised why (see above picture for my reaction). Change ...

Resources last updated: 3/24/2016 12:33:09 AM