Solved

Equivalent to err.number in php

Posted on 2007-03-17
13
480 Views
Last Modified: 2012-05-05
What is the equivalent to err.number in php?
0
Comment
Question by:pingeyeg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 18741555
Tell me what is err.number and what does it do, and I'll tell you what it is in php :))
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18741560
In ASP it is used in if...then statements.  For instance I have this block of code and I am trying to change it into PHP, but I don't know what the equivalent is in PHP.

If Err.Number <> 0 Then
         
            strValid = "<p align=center><font face="Verdana" size="2" color="#F0000"><b>"
                       "Sorry!</font></b><font face="Verdana" size="2" color="#000080"> This informatino has already been added.</font><br>"
                       "<br><font face="Verdana" size="2" color="#000080">Please choose a different <b>E-Mail Address</b> and <b>Password.</b></br>"
                       "</font></p>"
        else
                        strValid = "<p align="left"><b><font face="Verdana" size="2" color="#008080">Provider's information has been added successfully!</b></font>"
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18741565
What type of error?  Since some of the previous questions have been about MySQL I will assume that is what you want to check and report.

mysql_errno() returns the number for the error message.

mysql_error() returns the error message.

Each funtion takes the "identifier" as the argument in the function.

Let me know if I misunderstood or you need details.

bol
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 18741568
in PHP you don't have the err object.
you have to check for each statement if it worked or not.
and that "translation" depends on what exactly you did on the line before.

typically, you call a function like this:
$result = @function_name($argument) or die("error message" );

0
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 18741570
So what triggers err.number to be non-zero?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18741576
I also refer to my comments in your question you closed some minutes ago:
you seem to be learning php. if that is the case, do so.
if you are just trying to translate .asp into .php without reviewing the code and eventually improving it (with the power php can give you), you are doing a nonsense job.
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18741591
What do you mean by a nonsense job?
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18741599
I am slowly learning php right now.  I am in the middle of switching hosting companies to a Unix based server so I will be using PHP.  I know ASP very well, but the code is a bit differnent and I am just trying to convert myself over to the different language.  Right now I don't have a lot of time to research piece by piece to translate.  Once I finish the translation I will seriously dig deeper to learn this stuff.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18741603
why would you just translate working asp pages into php?

if you want to learn php, learn php. do not try to learn it by translating from any other language, as you will miss the powers of php.
I do not speak about general algorythms, they remain the same.
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18741611
I'm switching over to this language because of it being so powerful.  I just happen to switch at a bad time in the production of this site so I am pressed for time in learning it until I get done what I need to get done.  
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 18741613
I see you answered my question about the "why". still, you should not do this in a hurry, because the results will be "terrible". I can promise you that, because I had exactly that experience. I translated my asp pages / knowlege into php pages on my dev server. looked fine. uploaded to the prod (hosting) server, and the results were desastreous. It took me 2 days for the initial translation, and 2 weeks to get all the errors out of it. all the problems where due to my lack of understanding of how php works, especially in a secured environment (on a hosted server) compared to a "install-at-once" download package for newbies of php+mysql ...
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18741642
I see what you mean and I am learning as we speak.  It doesn't hurt though to get a good kick in the right direction.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18741652
good luck :-)

note that I do often write syntax errors in all the languages I write, as I often confuse them:
VB 6
VB.Net
C#
php
asp
asp.net
SQL Server
MySQL
Oracle
Access
and some others...


in regards to your project(s), you might want to get some tools:
http://www.freedownloadscenter.com/Best/php-html-parser.html

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question