php coding for sql

Started on the old forum in August 2013 · view the original in the archive · old links redirect here

7 replies · 1,191 views · started 13 years ago · 1 min read

3 participants
loveme Junior · 16 posts #1

HI.... I have a excel file with five coumns named as Sl..No Name ,Age, Sex, and Photo... In the columns of Sl.No,Name,Age,Sex have datas and the photos in separate folder named as "photos" with each file named as "Name" ...

Here I want a page like in A4 size print with print button:

Sl.No: (drop down box with list of Sl.No)

Name :

Age :

Sex: Photo: (here the particular photo)

                     Print

I hope , I made it understand to you... Thank You ...

loveme Junior · 16 posts #3

something else wrote: Have you attempted scripting this yourself?

I tried like this for data... but I struck in photos.. How do I connect them with sql and how do relate with my db table... please guide Me... and thank 4 for your reply..

My searc.php code

<?php
$hostname_php_result_conn = "localhost";
$database_php_result_conn = "trail";
$username_php_result_conn = "test";
$password_php_result_conn = "test123";   
$php_result_conn = mysql_connect($hostname_php_result_conn, $username_php_result_conn, $password_php_result_conn);
mysql_select_db($database_php_result_conn,$php_result_conn);

if(isset($_POST['submit'])) {
   $roll_no = $_POST['roll_no'];
   
   $sql1 = mysql_query("SELECT Sl FROM marks WHERE Sl = $roll_no");
   $row1 = mysql_num_rows($sql1);
   
   if($row1 == 0) {
      echo 'Error, ID does not exist';
   } else {

$sql1 = mysql_query("SELECT * FROM marks WHERE Sl = $roll_no");
$row1 = mysql_fetch_array($sql1);
$name = $row1['Name'];
$sex = $row1['Sex'];
$age = $row1['Age'];

echo 'Name = '.$name.'<br />
Sex = '.$sex'<br />
Age = '.$age;

echo'<form>
<input type="button" value="Print Page" onClick="window.print();">
</form>';
   }   
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Search</title>
</head>
<body>

<form action="searc.php" method="post">
<input name="roll_no" type="text" id="roll_no" />
<input type="submit" name="submit" value="search" />
</form>
</body>
</html>

<?php
}
?>
loveme Junior · 16 posts #6

kevk3v wrote: Attach the file 8)

Here the file attached. Sorry for the delay. I'm out of station. Sorry once again

Attachments: searc.txt
kevk3v Senior · 332 posts #7

Not that one, the excel file lol do you have to use smarty?

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close