
per1os
New Members-
Posts
3,095 -
Joined
-
Last visited
Everything posted by per1os
-
[SOLVED] Calling a class within a function
per1os replied to steelmanronald06's topic in PHP Coding Help
<?php class ErrorReporting { // Define some variables var $page; var $error_msg; function databaseInsert() { $page = $this->page; $error_msg = $this->error_msg; if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } else { $ip = $_SERVER['REMOTE_ADDR']; } return mysql_query("INSERT INTO errors (date, page, ip, error_msg) VALUES (now(), '$page', '$ip', '$error_msg')"); } } ?> <?php function queryErrorCheck($query) { // // Error checks queries // global $db; global $path; $report = new ErrorReporting; $errorMsg = $db->ErrorMsg(); $report->page = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"; $report->error_msg = "The following error: ' $errorMsg ' was recieved on the query: $query "; if (!$report->databaseInsert()) { die("MySQL Encountered a fatal error:" . mysql_error()); } echo ' <img src="' , $path , 'includes/img/error.jpg" alt="Error" /> <p>We are sorry, but an unexpected error has occured. Please try your request again. If the problem continues, the administrators will be notified and the problem will be addressed. If you have had a loss of money, items, or your stats are no longer correct because of this error, please contact an administrator and we will investigate our logs and refresh your stats to the last correct settings.</p> '; } ?> Try that see where it gets you. If I was a betting man I would say it is in the "date" column, maybe try to surround that in ` ` or rename it. --FrosT -
$_REQUEST has been depreciated for some time, I would use $_POST. --FrosT
-
<?php echo "<table>"; $query="SELECT foo FROM bar"; $result=mysql_query($query); $num=mysql_numrows($result); for ($i=0; $num > $i; $i++) $newData[$i]=mysql_fetch_array($result); mysql_close(); for ($i=0; count($newData) > $i; $i++) { $currentRow = $newData[$i]; echo "<td>$currentRow[id]</td>" ."</td>\n"; if(($i % 3 == 0) { echo "</tr>\n<tr>\n"; } } echo "</table>"; ?> See if that helps anything. --FrosT
-
<?php if (strtolower($discount) == "yes") { $discountPrice =($price \ .5); $newPrice = $price - $discountPrice; } ?> --FrosT
-
delete files recursive from extention list
per1os replied to biedubbeljoe's topic in PHP Coding Help
http://us2.php.net/manual/en/ref.dir.php http://us2.php.net/manual/en/class.dir.php http://us2.php.net/manual/en/function.pathinfo.php That should be all you need. --FrosT -
[SOLVED] php and postgres help, real easy for vets
per1os replied to Diceman's topic in PHP Coding Help
Especially if you consider more than half the people who post here want something different and have not looked at php.net for the answer and than they expect other users to write out their code for them. Basically you were showing a huge lack of effort to display that data by not even giving us a starting point that you were trying. Next time try first and if that does not work post that code with the description of what you are trying to do. People are more willing to help if someone has put forth the effort and it is visably seen with code. --FrosT -
MySQL and a Link Management type script. Basically all your links have to go through a file IE: link.php?linkid=3 would be http://www.google.com And in the link.php file is where you would do the data processing ie: <?php //link.php // process db calls etc here. // Redirect user using link from database. header("Location: " . $linkURLFromDB); die(); ?> --FrosT
-
<?php $search=mysql_query("SELECT hacksid, hackname FROM hacks WHERE `typeid`={$_GET['cat']}"); while($result=mysql_fetch_array($search)){ print "pagename.php?hackid=".$result["hackid"]; } ?> --FrosT
-
PHP gets it time from the server. If the server time is 5:00pm and your time is 4:00pm, the time is going to be off by an hour, unless you specify an offset via a cookie or something. --FrosT
-
Assign results of query to user defined variables
per1os replied to dlcmpls's topic in PHP Coding Help
<?php $Link = mysql_connect("$Host", "$User", "$Password") or die ('I cannot connect to the database.' . mysql_error()); mysql_select_db("$DBName"); $fruitquery = mysql_query("SELECT * FROM fruit"); while($Row = mysql_fetch_array($fruitquery)) { $fruitNames[$Row['fruitid']] = $Row['FruitName']; } print $fruitNames[0]; // should print Orange sort($fruitNames); print $fruitNames[0]; // should print Grape ?> That is how you get it in an array and you can sort the array to display particular values. --FrosT -
Yea, I like bwochinkski's way better. --FrosT
-
http://us2.php.net/manual/en/function.odbc-connect.php http://www.easysoft.com/developer/languages/php/apache_odbc.html Maybe those can help? --FrosT
-
That would explain why the include didn't work and why file_get_contents didn't work http://us2.php.net/manual/en/function.file-get-contents.php (note version information) The file_get_contents2(); would have worked if the fopen works. If the fopen is not allowed to connect to a remote site than I think you are SOL. http://us2.php.net/manual/en/function.fopen.php Maybe look through that at the user comments. Best of luck. --FrosT
-
The mktime() function might be of use: // get the unix time stamp $time = mktime(0,0,0,$month, $day, $year); $dateDisplay = date('m.n.Y', $time); References: http://us2.php.net/manual/en/function.mktime.php http://us2.php.net/manual/en/function.date.php --FrosT
-
No clue, maybe try and google ODBC and PHP and see if there is a bug or some type of setting that needs to be set. --FrosT
-
as posted on: http://us2.php.net/manual/en/function.include.php Warning Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files via this function, even if allow_url_fopen is enabled. allow_url_fopen that is probably disabled via your host, if that is there is really no luck for you unless you can google a allow_url_fopen workaround and find that. --FrosT
-
Have you tried to do a SQL statement after the connection is initiated? --FrosT
-
Looks right to me, maybe a half-assed solution is trying to include the file? I am not sure if it will work but give it a try ob_start(); include("http://maps.google.com/maps/geo?key=ABQIAAAAR0Cth1uWGX8aUnZOUNxxDRSTa-vPv41zs_3mMYBEENmT6-JqMxQvgmczA_f8sbJvBlQCW7hrjqwVQA&output=cvs&q=3060+Packard+Rd,+Ann+Arbor,+MI"); $string = ob_get_contents(); ob_end_clean(); echo $string; --FrosT
-
Include Option Makes My Content Dissapear. PLEASE HELP!
per1os replied to jamboemm's topic in PHP Coding Help
Dreamweaver probably isn't the best spot to try includes for php etc. I am not sure if dreamweaver includes it's own php files so it can check syntax etc, but yea. If not you may have to install php on your system locally. For me, I just as well use apache and php with notepad++ for all my coding. --FrosT -
I feel so silly for asking this but I need a little PHP help
per1os replied to angelkelly's topic in PHP Coding Help
include("FCKeditor/fckeditor.php") ; The file you need to include is in the FCKeditor dir called fckeditor.php http://wiki.fckeditor.net/Developer%27s_Guide/Integration/PHP --FrosT -
File1.php <html> <a href="process.php">Pay Now!</a> </html> process.php <?php // process the pay pal data here //redirect user to paypal site for payment header("Location: http://www.paypalste.com/page?parameters=ok ?> If that is not it, you need to be alot more clearer on what you want. --FrosT
-
I feel so silly for asking this but I need a little PHP help
per1os replied to angelkelly's topic in PHP Coding Help
Well what I meant was the what I put for fckeditor.class.php, that needs to point to the actual file you are suppose to be including, I am not sure what that is. Replace that with what it should be and it should work. --FrosT -
The reason being is the count(*). Try this: $nrfn = mysql_result ( mysql_query("select count(giver) as nr from feedback where rec ='".$_SESSION['id']."' and rating = 3 GROUP BY giver") ,0,"nr" ); $nrfp = mysql_result ( mysql_query("select count(giver) as nr from feedback where rec ='".$_SESSION['id']."' and rating = 1 GROUP BY giver") ,0,"nr" ); --FrosT
-
http://us2.php.net/manual/en/ref.dir.php http://us2.php.net/manual/en/class.dir.php Your best bet is to read up on the dir class. --FrosT
-
if (isset($_POST['btnSubmit'])) { // user clicked paypal button. // do processing here header("Location: http://www.paypalste.com/page?parameters=ok } If thats not what you are looking for post some code. --FrosT