Jump to content

Help with html tags to put the tags in the same line


mark103

Recommended Posts

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
  	}
}
}
?>

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.