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 04-11-2022, 12:40 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,129
Row with no contents, how to remove in output?

So I have a table that has a row of URLs in it, some of the rows do not have any data in them.

When outputting the data to a page, how can I make it so that the code where that url should appear dissapears from the page?

This is the code I'm using:

Quote:
<strong><a href="<?php echo $One; ?>">One</a></strong> |
<strong><a href="<?php echo $Two; ?>">Two</a></strong> |
<strong><a href="<?php echo $Three; ?>">Three</a></strong> |
<strong><a href="<?php echo $Four; ?>">Four</a></strong></p>
One, Two, Three & Four are all links to our product on a specific online store, I'm thinking its something to do with either and "if" or an "echo" statement(?) but I cant seem to figure out the right code to get it working.

Basically, if the row for 'Two' has no data in it, how do i get it to just vanish from the 4 options?

So instead of:

One | Two | Three | Four

It shows:

One | Three | Four

The data calls are in an array at the top of the page if that helps any?
__________________
SOMETHING EXTREME IS COMING SOON!
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-11-2022, 01:25 PM   #2
NatalieK
Natalie K
 
NatalieK's Avatar
 
Industry Role:
Join Date: Apr 2010
Location: Spain
Posts: 19,243
no, my bad, what i said was wrong from what iŽd read...


bounce for you, good luck
__________________
My official site Semi exclusive custom clips My affiliate programFirst time girls
Skype: gspotproductions - "Converting traffic into income since 2005"
NatalieK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-11-2022, 03:31 PM   #3
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,093
Hi,

You can put a simple IF before each row

Quote:
<?php if($One) { ?> <strong><a href="<?php echo $One; ?>">One</a></strong> | <?php } ?>
<?php if($Two) { ?> <strong><a href="<?php echo $Two; ?>">Two</a></strong> | <?php } ?>
<?php if($Three) { ?> <strong><a href="<?php echo $Three; ?>">Three</a></strong> | <?php } ?>
etc

You can also use trim($var) and strlen($var) > 0 if there is a chance that your DB has rows with only spaces by mistake.

'The data calls are in an array at the top of the page if that helps any?'

If you have everything in your array, you can simply use the function implode() and you are good to go.

Show me a print_r of your array and I can help you further.

Cheers,
z
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-11-2022, 05:47 PM   #4
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,129
Quote:
Originally Posted by zerovic View Post
Show me a print_r of your array and I can help you further.
This is literally all the code I have in the page (its real basic).

Quote:
<?php

$id=intval($_GET['id']);

if($id==0)

{

header( "Location: /search" ); //or any other page like 404

exit;

}

$pdo=hookitup();

$table = "ProductLibrary";

$sql="select * from " . $table . " where ID=" . $pdo->quote($id);

//echo "sql=" . $sql . "<br>";

$stmt=$pdo->query($sql);

//echo "rows back=" . $stmt->rowcount() . "<br>";

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

$id = $row['ID'];
$Category = $row['Category'];
$Name = $row['Name'];
$One = $row['One'];
$Two = $row['Two'];
$Three = $row['Three'];
$Four = $row['Four'];

?>
Im just echo'ing the data onto the page where I need to display it from the array.
__________________
SOMETHING EXTREME IS COMING SOON!
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-11-2022, 05:50 PM   #5
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,129
Quote:
Originally Posted by zerovic View Post
Hi,

You can put a simple IF before each row
That will work even if all im pulling into the page from the database is the URL itself?
__________________
SOMETHING EXTREME IS COMING SOON!
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-11-2022, 06:01 PM   #6
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,129
That IF statement works perfectly for what I needed, thank you so much for the code 👍
__________________
SOMETHING EXTREME IS COMING SOON!
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-12-2022, 12:47 AM   #7
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,093
Yeah, looking at your code, the IF function is what you are looking for
__________________
php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-12-2022, 04:57 AM   #8
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Quote:
Originally Posted by zerovic View Post
Hi,

You can put a simple IF before each row



etc

You can also use trim($var) and strlen($var) > 0 if there is a chance that your DB has rows with only spaces by mistake.

'The data calls are in an array at the top of the page if that helps any?'

If you have everything in your array, you can simply use the function implode() and you are good to go.

Show me a print_r of your array and I can help you further.

Cheers,
z
You have to use isset() or empty() now, otherwise it throws a fatal error in PHP8
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-12-2022, 12:06 PM   #9
Clown
Registered User
 
Clown's Avatar
 
Industry Role:
Join Date: Feb 2022
Posts: 40
Quote:
Originally Posted by k0nr4d View Post
You have to use isset() or empty() now, otherwise it throws a fatal error in PHP8
Correct. Proper error checking is a must for PHP.
__________________
Cheap VPS/Shared Hosting: RackNerd
Discord: Clown#5147
Projects: JuicySluts
Website: Clownonymous
Other Domains: JuicyBate - HornyFeed - Pimp Ink - Fansily

Skills: API/HTML/CSS/JS/PHP/PYTHON
Clown is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-13-2022, 02:06 AM   #10
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,093
Quote:
Originally Posted by k0nr4d View Post
You have to use isset() or empty() now, otherwise it throws a fatal error in PHP8
Yeah, you are right.
__________________
php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com
zerovic is offline   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
row, data, page, code, url, dissapears, outputting, rows, output, table, remove, contents, urls



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.