Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-06-2021, 07:54 PM   #51
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Fiddy PHP Errors....


Just realized, you pull author into a field called random_tags but you never do use it any where.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-06-2021, 08:22 PM   #52
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by sarettah View Post
Put the command: error_reporting[E_ALL]; at the very top of the program, once you have all the errors debugged then change it to error_reorting[0]; anytime you neeed to debug change it back to E_ALL . E_ALL tells it to show you all errors no matter how small. A beginner should NOT be ignoring any errors.
.
man, I fucked that up.

the command is error_reporting(E_ALL);

damn.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-06-2021, 08:34 PM   #53
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by sarettah View Post
Fiddy PHP Errors....


Just realized, you pull author into a field called random_tags but you never do use it any where.

.
Yeah, thats for something a little further along the line, when it comes to adding new recipes to the DB via a form on the site.

Playing with the code you posted now, shall report back in a little while, thank you again for your help with this php stuff, I really appreciate your time and assistance
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-06-2021, 08:46 PM   #54
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
A cleaner version. More my style. No camelcase shit ;p

<?php
error_reporting(E_ALL);

$id=0;
if ( ! isset($_GET['id'] ) )
{
header('Location: index.php');
}
else
{
$id=intval($_GET['id']);
}
if($id==0)
{
die('bad id passed in');
}

$pdo=hookitup();

$table = "recipes";
$sql = "select * from " . $table . " where id=?";

try
{
$stmt = $db->prepare($sql_str);
$stmt->execute(array($pdo->quote($id)));
}
catch( PDOException $e)
{
die($e-getMessage());
}

$row=$stmt->fetch(PDO::FETCH_ASSOC);

$title = $row['recipename'];
$description = $row['recipedescription'];

?>
<html>
<head>
<base href="https://gfy.com/" /><!--[if IE]></base><![endif]-->
<base href="https://gfy.com/" /><!--[if IE]></base><![endif]-->
<base href="https://gfy.com/" /><!--[if IE]></base><![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<title><?php echo $title; ?> Recipe | Sitename</title>
<meta name="Description" content="<?php echo $description; ?>">
<meta name="Keywords" content="<?php echo $title; ?> Recipe Ingredients Make <?php echo $title; ?> Recipes">
<link rel="stylesheet" href="style.css" type="text/css"/>

<link rel="canonical" href="//siteurl/">
</head>

<body class="home page page-id-21 page-template-default ie et_includes_sidebar">

<?php
require_once('./templates/header.php');
?>

<div id="hd_logo0">
<p>
<a href="http://www.domain.com">
<img class="alignnone size-full wp-image-169" alt="" src="logo.png" style="width: 310px"/>
</a>
</p>
</div>

<?php
require_once('./templates/secondary.php');
?>

<center>
<div id="main-area">
<div class="container" style="left: 0px; top: 0px">
<div id="content-area" class="clearfix">
<div id="left-area">
<div id="breadcrumbs" class="clearfix">
<a href="http://www.domain.com" class="breadcrumbs_home">Home</a>
<span class="raquo">&raquo;</span>
</div>
<article id="post-21" class="post-21 page type-page status-publish hentry entry clearfix">
<div class="post_content clearfix">
<h1 class="title">Home</h1>
<?php
require_once('./templates/midbanner.php');

echo "<table>";
echo "<tr>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['ingredients'] . "</td>";
echo "<td>" . $row['method'] . "</td>";
echo "</tr>";
echo "</table>";
?>
</div>
</article>
</div>
<?php
require_once('./templates/sidebar.php');
?>
</div>
</div> <!-- end .container -->
</div> <!-- end #main-area --></center>

<?php
require_once('./templates/footer.php');
?>
<script type="text/javascript" src="jquery.form.min.js"></script>
<script type="text/javascript" src="superfish.js"></script>
<script type="text/javascript" src="jquery.fitvids.js"></script>
<script type="text/javascript" src="custom.js"></script>
</body>

</html>

<?php

function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$host;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

In dbcreds.php would be:

<?php
$dbname='dbname';
$dbuser='dbusername';
$dbpass='dbpassword';
$dbhost='localhost';
?>

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-07-2021, 06:08 AM   #55
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
A small addition to the code above:

$title = ucwords($row['recipename']);
//Personal taste, but I like titles like that. The above makes each first character of a word uppercase: This Is A Great Title

$description = ucfirst($row['recipedescription']);
//Makes the first character of your string uppercase (in case it isn't stored that way in the database. It looks pretty bad in the search results if your description's first letter isn't uppercase.
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-07-2021, 08:47 PM   #56
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Apologies for the late response, we lost power again last night while they were working on the lines to try and get the rest of the neighborhood up and running.

I played with the code you posted and seem to be getting a weird error where the data from the SQL isn't showing, its just giving me a blank page and there are no meta tags showing up either. (Didn't change anything until after the blank page showed).

Putting back the original code, the page works how it is supposed to, any thoughts?
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-07-2021, 09:35 PM   #57
k33n
Confirmed User
 
Join Date: Feb 2009
Posts: 201
Code:
$sql = "select * from " . $table . " where id=?";

try
{
$stmt = $db->prepare($sql_str);
Replace $sql_str with $sql
k33n is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-07-2021, 10:01 PM   #58
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by k33n View Post
Code:
$sql = "select * from " . $table . " where id=?";

try
{
$stmt = $db->prepare($sql_str);
Replace $sql_str with $sql
K33n,

I gave that a try and its still showing a blank page, this is the error from the logs:

Quote:
#0 /blah/blah/domain.com/recipesnew.php(119): PDO->__construct('mysql:host=;dbn...', NULL, NULL, Array)
#1 /blah/blah/domain.com/recipesnew.php(18): hookitup()
#2 {main}
thrown in /blah/blah/domain.com/recipesnew.php on line 119
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 02:27 AM   #59
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Quote:
Originally Posted by Publisher Bucks View Post
K33n,

I gave that a try and its still showing a blank page, this is the error from the logs:
function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$host;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

dbcreds file:
<?php
$dbname='dbname';
$dbuser='dbusername';
$dbpass='dbpassword';
$dbhost='localhost';
?>

These two don't match, that's why you're getting a blank page (as no database connection is being made).


Change the function to:

function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

And as K33n noted, change:

$stmt = $db->prepare($sql_str);

to:

$stmt = $db->prepare($sql);
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 03:51 AM   #60
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
To OP: You can learn a lot from looking more closely to your error log. This one was easy to spot.

Your error: #0 /blah/blah/domain.com/recipesnew.php(119): PDO->__construct('mysql:host=;dbn...', NULL, NULL, Array)

See how host= is empty...
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 05:35 AM   #61
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by zijlstravideo View Post
function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$host;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

dbcreds file:
<?php
$dbname='dbname';
$dbuser='dbusername';
$dbpass='dbpassword';
$dbhost='localhost';
?>

These two don't match, that's why you're getting a blank page (as no database connection is being made).


Change the function to:

function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

And as K33n noted, change:

$stmt = $db->prepare($sql_str);

to:

$stmt = $db->prepare($sql);
Thank you.

Its still not showing anything BUT, does that mean I also need to make the following changes based on this error?

Quote:
#0 /blah/blah/domain.com/recipesnew.php(118): PDO->__construct('mysql:host=loca...', NULL, NULL, Array)
#1 /blah/blah/domain.com/recipesnew.php(18): hookitup()
#2 {main}
thrown in /blah/blah/domain.com/recipesnew.php on line 118
return new PDO("mysql:host=$dbhost;dbname=$dbname" ,$dbuser,$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

Or am I looking in the wrong place/overthinking and doing the wrong thing?
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 06:12 AM   #62
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Yup, good catch. Those as well.
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 07:25 AM   #63
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Sorry about that. I didn't do a full test and that kind of shit happens when you meld 2 different sets of code together.

In this case, I grabbed my dbcreds file from my local machine and my hookup routine from a different place.

But that is what debugging is for, ya know?

I really didn't think you were just going to switch out to the new code I posted, I was just trying to get to a code set that made sense to me.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 07:52 AM   #64
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by zijlstravideo View Post
Yup, good catch. Those as well.
I'm still missing something though as its giving a 500 error.

Quote:
Stack trace:
#0 /blah/blah/domain.com/recipesnew.php(118): PDO->__construct('mysql:host=loca...', NULL, NULL, Array)
#1 /blah/blah/domain.com/recipesnew.php(18): hookitup()
#2 {main}
thrown in /blah/blah/domain.com/recipesnew.php on line 118
Which makes no sense as I made those changes already
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 07:56 AM   #65
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Publisher Bucks View Post
I'm still missing something though as its giving a 500 error.



Which makes no sense as I made those changes already
What does line 118 look like in your program?

From the error you posted it appears that you do not have anything populated into your $dbuser and $dbpass variables.

But post line 118 of the program, please.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 07:57 AM   #66
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by sarettah View Post
Sorry about that. I didn't do a full test and that kind of shit happens when you meld 2 different sets of code together.

In this case, I grabbed my dbcreds file from my local machine and my hookup routine from a different place.

But that is what debugging is for, ya know?

I really didn't think you were just going to switch out to the new code I posted, I was just trying to get to a code set that made sense to me.

.
No apologies needed, I'm learning so figured grabbing your code was the easiest way to figure out what I'm actually fucking up on my end of things and having a 'working' code (that doesn't on occasion) is a good way for me to screw around and check what isn't working and why

I'm really appreciative of everyone's help, assistance and knowledge in this thread as I'm sure you all have other things you could be doing instead of sharing your expertise.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 08:00 AM   #67
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by sarettah View Post
What does line 118 look like in your program?

.
Line 118 in recipesnew.php is:

Quote:
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,$dbuser,$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
Also, a quick question sarettah, what is the purpose of having the charset=utf8 in there? Wont it do the same thing without that? Just pull the databases name, or is that a security thing?
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 08:28 AM   #68
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Quote:
Originally Posted by sarettah View Post
Sorry about that. I didn't do a full test and that kind of shit happens when you meld 2 different sets of code together.

In this case, I grabbed my dbcreds file from my local machine and my hookup routine from a different place.

But that is what debugging is for, ya know?

I really didn't think you were just going to switch out to the new code I posted, I was just trying to get to a code set that made sense to me.

.
Lol, it's always those small things that mess things up. I once wasted an entire day because I had a white space in the $dbpass = "pass ";

By the way, I think you can even shorten this:

$id=0;
if ( ! isset($_GET['id'] ) )
{
header('Location: index.php');
}
else
{
$id=intval($_GET['id']);
}
if($id==0)
{
die('bad id passed in');
}

Into:

$id=intval($_GET['id']);
if($id==0)
{
header( "Location: index.php" ); //or any other page like 404
exit;
}

As intval will also output 0 if $id is empty.
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 08:44 AM   #69
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by Publisher Bucks View Post
Line 118 in recipesnew.php is:



Also, a quick question sarettah, what is the purpose of having the charset=utf8 in there? Wont it do the same thing without that? Just pull the databases name, or is that a security thing?
Your error: /blah/blah/domain.com/recipesnew.php(118): PDO->__construct('mysql:host=loca...', NULL, NULL, Array)

indicates that you are not passing in a username or password. The places that say NULL, NULL right before the Array indicate that $dbuser and $dbpass are coming in as NULL meaning there ain't nothing there.

Your error: /blah/blah/domain.com/recipesnew.php(118): PDO->__construct('mysql:host=loca...', NULL, NULL, Array)

PDO("mysql:host=$dbhost;dbname=$dbname" ,$dbuser,$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}


So, if you are using the dbcreds.php file then the problem is in there. If you are not using that and have the user and password hardcoded then that would be where the issue is.


The charset=utf8 just tells it to accept utf8 characters. The routine I pulled it from has to handle various different languages. I pretty much have everything I do coded for utf8 (unicode).

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 08:47 AM   #70
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Quote:
Originally Posted by zijlstravideo View Post
Lol, it's always those small things that mess things up. I once wasted an entire day because I had a white space in the $dbpass = "pass ";

By the way, I think you can even shorten this:

$id=0;
if ( ! isset($_GET['id'] ) )
{
header('Location: index.php');
}
else
{
$id=intval($_GET['id']);
}
if($id==0)
{
die('bad id passed in');
}

Into:

$id=intval($_GET['id']);
if($id==0)
{
header( "Location: index.php" ); //or any other page like 404
exit;
}

As intval will also output 0 if $id is empty.
Yep, that would work.

I tend to, when trying to do code 101 stuff use old old school. First step intialize variable to default value then use it.

But yeah you are initializing it to whatever comes into the get if it is a valid int or zero if not so it does the same thing in a couple of less words.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 10:02 AM   #71
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by sarettah View Post
indicates that you are not passing in a username or password. The places that say NULL, NULL right before the Array indicate that $dbuser and $dbpass are coming in as NULL meaning there ain't nothing there.
Okay, I think it has something to do with this part at the bottom of the coding (my version)...

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,$username,$password,array(PDO::ATTR_EMULATE_PREPA RES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
So, if you are using the dbcreds.php file then the problem is in there. If you are not using that and have the user and password hardcoded then that would be where the issue is.

This is the dbcreds.php file that is being used:

Quote:
$dbname='database';
$dbuser='user';
$dbpass='password';
$dbhost='localhost'
Am I right in assuming the above code should look like this on the bottom of recipesnew.php:

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,$dbuser;$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
Because I tried changing the dbpassword part and it still shows a blank page, I know 100% the information in the dbcreds.php is correct and there was a mismatch of the naming, which I (think) I corrected? Or does that entire string need to be included in quotation marks like this...

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8;$d buser;$dbpass",array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
I think I'm confusing myself with the edits somewhere in this specific section
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 11:32 AM   #72
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
The code you are posting looks right The bottom part you posted at the end where you moved the quote marks is wrong.

The part of the error you are showing us indicated that there is nothing in the username and password variables which would mean the problem is in the dbcreds.php like I said earlier.

I have sent you a pm.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 11:53 AM   #73
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
I sent this via pm also but

in the dbcreds.php you are missing a semicolon after localhost

$dbhost='localhost'

Should be

$dbhost='localhost';


.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 12:04 PM   #74
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
In the code you sent me:

return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,dbuser=$dbuser;dbpass=$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));

should be:

return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8",$dbuser,$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));

You added an equals sign in the dbuser and dbpass that should not be there.

There is still an issue in the code. I am looking.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 12:11 PM   #75
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
On line 15-17 you have a try statement that is not completed:

try
{
$sql = "select * from " . $table . " where id=?";

Get rid of that.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 12:27 PM   #76
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
A mistake in the code I posted.

around line 16:

try
{
$stmt = $db->prepare($sql);
}
catch( PDOException $e)
{
die($e-getMessage());
}

should be:

try
{
$stmt = $pdo->prepare($sql);
}
catch( PDOException $e)
{
die($e-getMessage());
}

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 12:32 PM   #77
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Damn I suck today

Another issue in what I posted:

try
{
$stmt = $pdo->prepare($sql);
}
catch( PDOException $e)
{
die($e-getMessage());
}

Should be:

try
{
$stmt = $pdo->prepare($sql);
}
catch( PDOException $e)
{
die($e->getMessage());
}

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 12:42 PM   #78
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Also, (this one is not my mistake) you removed the execute statement from that same code block.

So:

try
{
$stmt = $pdo->prepare($sql);
}
catch( PDOException $e)
{
die($e->getMessage());
}

Should be:

try
{
$stmt = $pdo->prepare($sql);
$stmt->execute(array($pdo->quote($id)));
}
catch( PDOException $e)
{
die($e->getMessage());
}
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 04:05 PM   #79
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
Well, that was fun.

To whoever was watching, the OP and I took it private so I could see the actual code without revealing any proprietary info.

It looks like he is in pretty good shape now.

It was mainly syntax issues.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 04:06 PM   #80
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
sarettah,

I just want to say thank you for all of your help, not only in this thread over the past week but also by PM, you truly do not know how appreciative I am of your time helping me to get this pet project working, I'm sure there are a hundred other things you could have been doing this afternoon instead of spending time to get this working for me.

I'm going to play around with a couple of other formatting issues that I'm having but other than that, I am really happy with how this site has turned out, even though its just a pet project of mine and not really going to be a money maker its good to start seeing it come to fruition

Thank you so much
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-08-2021, 04:54 PM   #81
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,057
No problem. You are welcome.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
page, weeks, code, website, wild, supposed, told, covid, issue, index, recipes.php, messed, guidance, clicked, generated, link, recipes.php?id=4, ago, telling, site, recipe, clue, php, vomiting, finally



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.