473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with displaying records

Hi,

Here i pasted Three scripts first one is displaying the details which
i have stored in database this is working but in second script is in
link with first one if i click main.php it displays all the details in
the database if i click one particular detail i want to see the
details about that( so i gave link in main.php scriptl).Here i
mentioned some sql line i got some problem from there

$edit="select subject from addevent where event ='$_POST[event]'";
if i use var_dump() it gives output as NULL.

If i give like this i got output as a blank page.

$edit="select subject from addevent where event ='deepavali'";

If i mentioned particular event then it displays the details adout
that partcular event I cant found the error from that code.Tell me in
this how to retrive the values .I got the same thing in to some other
scripts also.

----------------------------Main.php---------------
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// 
  2. www.w3.org/TR/html4/loose.dtd"> 
  3. <html> 
  4. <head> 
  5. <title>Untitled Document</title> 
  6. <meta http-equiv="Content-Type" content="text/html; 
  7. charset=iso-8859-1"> 
  8. </head> 
  9.  
  10. <body> 
  11. <?php 
  12. include('connect.php'); 
  13. $sql="SELECT * FROM addevent"; 
  14. // OREDER BY id DESC is order result by descending 
  15. $result=mysql_query($sql); 
  16.  
  17. ?> 
  18. <table width="90%" border="0" align="center" cellpadding="3" 
  19. cellspacing="1" bgcolor="#CCCCCC"> 
  20. <tr><div align="center"><h1>List Of Events</h1></div></tr> 
  21. <tr> 
  22. <td width="6%" align="center" bgcolor="#E6E6E6"><strong>Event</ 
  23. strong></td> 
  24. <td width="6%" align="center" bgcolor="#E6E6E6"><strong>Country</ 
  25. strong></td> 
  26. <td width="53%" align="center" bgcolor="#E6E6E6"><strong>Date</ 
  27. strong></td> 
  28. <td width="15%" align="center" bgcolor="#E6E6E6"><strong>Month</ 
  29. strong></td> 
  30. <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Year</ 
  31. strong></td> 
  32. </tr> 
  33. <?php 
  34. while($rows=mysql_fetch_array($result)) 
  35. // Start looping table row 
  36. ?> 
  37. <td bgcolor="#FFFFFF"> 
  38. <a href="event_view.php"<?php echo $rows['event']; ?>> 
  39. <?php echo $rows['event']; ?></a> 
  40. <BR> 
  41. </td> 
  42. <td align="left" bgcolor="#FFFFFF"><?php echo $rows['countryname']; ? 
  43. ></td> 
  44.  
  45. <td align="center" bgcolor="#FFFFFF"><?php echo $rows['date']; ?></td> 
  46. <td align="center" bgcolor="#FFFFFF"><?php echo $rows['month']; ?></ 
  47. td> 
  48. <td align="center" bgcolor="#FFFFFF"><?php echo $rows['year']; ?></td> 
  49. </tr> 
  50. <?php 
  51. // Exit looping and close connection 
  52.  
  53. mysql_close(); 
  54. ?> 
  55.  
  56. </table> 
  57. </body> 
  58. </html> 
  59.  
-------------------------------------------
view.php

Expand|Select|Wrap|Line Numbers
  1.  
  2. <html> 
  3. <style type="text/css"> 
  4. <!-- 
  5. .style3 {color: #FFFFFF; font-weight: bold; } 
  6. --> 
  7. </style> 
  8. <form name="form1" method="post" action=""> 
  9. <?Php 
  10. include('connect.php'); 
  11. $edit="select subject from addevent where event ='$_POST[event]'"; 
  12. $sql=mysql_query($edit); 
  13. //$editf1=mysql_fetch_assoc($sql); 
  14. $edits=mysql_query($edit); 
  15. echo $number = mysql_num_rows($edits); 
  16. while($editf1=mysql_fetch_assoc($edits)) 
  17. ?> 
  18.  
  19. </p> 
  20. <p align="center">&nbsp;</p> 
  21. <p align="center">&nbsp; </p> 
  22. <table width="900" border="1" align="center"> 
  23. <tr bgcolor="#666666"> 
  24. <td width="246"><span class="style3">Subject</span></td> 
  25. </tr> 
  26. <tr bgcolor="#CCCCCC"> 
  27. <td bgcolor="#FFFFFF"><?PHP echo $editf1['subject'];?></td> 
  28. </tr> 
  29. </table> 
  30. <p align="center">&nbsp;</p> 
  31. <?PHP 
  32.  
  33. ?> 
  34. </form> 
  35. </html> 
  36.  
thanks
Jul 16 '07 #1
11 1610
ak1dnar
1,584 Expert 1GB
Replace this

Expand|Select|Wrap|Line Numbers
  1. $edit="select subject from addevent where event ='$_POST[event]'"; 
  2.  
with this

Expand|Select|Wrap|Line Numbers
  1. $edit="select subject from addevent where event ='$_POST['event']'"; 
  2.  
Note: You have missed single quotes on $_POST array element.
Jul 16 '07 #2
ak1dnar
1,584 Expert 1GB
Please use [code] tags, Next time.

Then you are welcome to TSDN ! :)
-Ajaxrand
Jul 16 '07 #3
Iused that code but it creates error only
thanks
Jul 16 '07 #4
ak1dnar
1,584 Expert 1GB
Iused that code but it creates error only
thanks
Sorry I didn't get you properly..
Jul 16 '07 #5
pbmods
5,821 Expert 4TB
Heya, kavithadevan.

Iused that code but it creates error only
What error do you get?

Try this instead (note the curly braces):
Expand|Select|Wrap|Line Numbers
  1. $edit="select subject from addevent where event ='{$_POST['event']}'";
  2.  
For an explanation of why this works, check out this article.
Jul 16 '07 #6
Hi ,

Actually i am not getting any errror but i am trying to display some records using select statement if i am using like this in that above code wat i send


$edit="select subject from addevent where event ='$_POST[event]'";

it shows blank page only this query not taking the value of $_POST[event].


If i give event name directly it displys some records which i have stored in data base
$edit="select subject from addevent where event ='deepavali'";

Tell me now y my first query is not working wat is the main problem tell me some solution regarding that.




thanks

Heya, kavithadevan.



What error do you get?

Try this instead (note the curly braces):
Expand|Select|Wrap|Line Numbers
  1. $edit="select subject from addevent where event ='{$_POST['event']}'";
  2.  
For an explanation of why this works, check out this article.
Jul 17 '07 #7
ak1dnar
1,584 Expert 1GB
Hi ,

Actually i am not getting any errror but i am trying to display some records using select statement if i am using like this in that above code wat i send


$edit="select subject from addevent where event ='$_POST[event]'";

it shows blank page only this query not taking the value of $_POST[event].


If i give event name directly it displys some records which i have stored in data base
$edit="select subject from addevent where event ='deepavali'";

Tell me now y my first query is not working wat is the main problem tell me some solution regarding that.




thanks
Still you are showing us the same erroneous statement
[PHP] $edit="select subject from addevent where event ='$_POST[event]'";[/PHP]
This is incorrect.

Refer to the previous posts again to find out how to rectify the error.
Jul 17 '07 #8
pbmods
5,821 Expert 4TB
Heya, kavithadevan.

If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.
Jul 17 '07 #9
If i use these two lines in my script it displayls like this notice

error_reporting(E_ALL);
ini_set('display_errors', True);
in my script then it displays one notice like this notice
Notice:Undefined index: event in C:\wamp\www\admin\event\event_view.php on line 17
in that undefined index means wat how to clear that noice tell me suggestions
thanks

Heya, kavithadevan.

If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.
Jul 17 '07 #10
pbmods
5,821 Expert 4TB
Heya, kavithadevan.

That error means that $_POST['event'] has no value.
Jul 17 '07 #11
Hi ,
your telling no value that means no datas in database or i didnt assigned any value for that.Tell me hoe to clear this


thanks


Heya, kavithadevan.

That error means that $_POST['event'] has no value.
Jul 18 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
4
by: david | last post by:
Hi I have written code in ASP for paging records from the database (SQL Server 2000). The real problem I have around 10,000 records and it tries to fetch all the records everytime (I'm saying...
6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
4
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
1
by: sushant2009 | last post by:
Hi , I want to display empty databae table(actually table contains lot of records) to datagrid using dataset and dataadpter. After displaying i will fill new records in datagrid and i will save...
0
by: Lyn | last post by:
I have a problem using the form .Filter and .FilterOn properties which causes Access to crash (as detailed in a separate post). The form operates in continuous mode, displaying matching records...
5
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date :...
1
by: bhappy | last post by:
Hi All, I am generating a report using crystal reports formula fields and parameter fields, In report im getting all data but not in proper way, ie In 1st page --------Its displaying blank page...
2
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi all Got a weird problem with pagination on a datagrid in asp.net 1.1. It's populated depending on user selected criteria (it either displays all or 1 record). It works fine in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.