mark103 Posted March 4, 2012 Share Posted March 4, 2012 Do anyone know how i can put the html tags in the same line as the other html tags? Here's an example: Images | Link | Delete | Enabled On my code, it break the tags to the new line without put on the same line as the other tags. Here's the code: [code]<?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbtable'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); if($username == '') { $errmsg_arr[] = 'username ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD ID missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result) > 0) { $qrytable1="SELECT images, id, public FROM members WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { echo '<p id="images"> <a href="images.php?id='.$row['id'].'">Images</a></td> | <a href="http://' . $row["links"] . '">Link</a> </td> | <a href="delete.php?id='.$row['id'].'">Delete</a> </td> | <p> <p id="test">'.$row['Public'].'</td>''; } } } ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/ Share on other sites More sharing options...
Pikachu2000 Posted March 4, 2012 Share Posted March 4, 2012 Yes, because that's what paragraph tags are supposed to do. They start a new paragraph. Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323884 Share on other sites More sharing options...
litebearer Posted March 4, 2012 Share Posted March 4, 2012 Maybe my eyes are shot, but ... where are your table opening tag, your row opening and closing tags, and your opening cell tags? only your </td>'s are there Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323885 Share on other sites More sharing options...
mark103 Posted March 4, 2012 Author Share Posted March 4, 2012 Yes, because that's what paragraph tags are supposed to do. They start a new paragraph. i don't want a new paragraph in the same line as the other tags. Do you know how to put that tags of <p id="test">'.$row['Public'].' in the same line as the other tags? if so plz can you post an example code. Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323904 Share on other sites More sharing options...
litebearer Posted March 4, 2012 Share Posted March 4, 2012 Try this... <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbtable'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) {die('Failed to connect to server: ' . mysql_error());} $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); if($username == '') { $errmsg_arr[] = 'username ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD ID missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); }else{ $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result) > 0) { $qrytable1="SELECT images, id, public FROM members WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); ?> <table> <?PHP while ($row = mysql_fetch_array($result1)) { ?> <tr> <td><a href="images.php?id="<?PHP echo $row['id']; ?>">Images</a></td> <td> | </td> <td><a href="http://<?PHP echo $row['links']; ?>">Link</a></td> <td> | </td> <td><a href="delete.php?id="<?PHP echo $row['id']; ?>">Delete</a></td> <td> | </td> <td><?PHP echo $row['Public']; ?></td> </tr> <?PHP } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323912 Share on other sites More sharing options...
mark103 Posted March 5, 2012 Author Share Posted March 5, 2012 I don't like that idea and this isn't what i want, i still want to use the code like this: echo '<p id="images"> <a href="images.php?id='.$row['id'].'">Images</a></td> | <a href="http://' . $row["links"] . '">Link</a> </td> | <a href="delete.php?id='.$row['id'].'">Delete</a> </td> | <p> <p id="test">'.$row['Public'].'</td>''; I can't find out how to use the code to allow to use in each paragragh. You can see what my data is showing on my php at the moment. my data 1 | Images | Link | Delete | Enabled my data 2 | Images | Link | Delete | Disabled I want something to be shown on my php like this: my data 1 | Images | Link | Delete | Enabled my data 2 | Images | Link | Delete | Disabled Any idea how i can do this? Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323966 Share on other sites More sharing options...
litebearer Posted March 5, 2012 Share Posted March 5, 2012 You CANNOT use </td> WITHOUT <table> <tr> <td> that's just the way life is; HOWEVER; You might consider using Divs to accomplish Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1323997 Share on other sites More sharing options...
Pikachu2000 Posted March 5, 2012 Share Posted March 5, 2012 Yes, because that's what paragraph tags are supposed to do. They start a new paragraph. i don't want a new paragraph in the same line as the other tags. Do you know how to put that tags of <p id="test">'.$row['Public'].' in the same line as the other tags? if so please can you post an example code. If you don't want a new paragraph, what do you think might be the solution? Not using a paragraph tag, perhaps? Quote Link to comment https://forums.phpfreaks.com/topic/258272-help-with-html-tags-to-put-the-tags-in-the-same-line/#findComment-1324023 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.