studgate Posted August 18, 2007 Share Posted August 18, 2007 I am trying to get the id for a sql query. I put the code here, I want $page_id to be equal to the id of the current data. <?php $page_id = 1; include("comments/comments_show.php"); include("comments/comments_form.php"); ?> I did that but it didn't work <?php $page_id = <?php echo $row_Videos['videoid']; ?>; include("comments/comments_show.php"); include("comments/comments_form.php"); ?> Any help is welcome, thank you your welcome is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/ Share on other sites More sharing options...
ILYAS415 Posted August 18, 2007 Share Posted August 18, 2007 hav u srtated the session? always do session_start(); at the top of the page. also use the 2nd code u showed us. Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327563 Share on other sites More sharing options...
studgate Posted August 18, 2007 Author Share Posted August 18, 2007 I did start the session at the top of the page. Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327565 Share on other sites More sharing options...
ILYAS415 Posted August 18, 2007 Share Posted August 18, 2007 The only way i can think of is doing this... www.yourdomain.com/index.php?pageid=1 if (!isset($_GET['pageid'])){ $page_id= 1; }else{ $page_id= $_GET['pageid']; } //rest of script here Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327569 Share on other sites More sharing options...
studgate Posted August 18, 2007 Author Share Posted August 18, 2007 that won't work because the comment system that I need to integrate just needs the data id to differentiate between the other data in my database. I do have a lot of data and each has a different id#. I need to have get id# and then make so page_id = dataid I hope it makes sense. Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327574 Share on other sites More sharing options...
ILYAS415 Posted August 18, 2007 Share Posted August 18, 2007 can i see the whole script plz? Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327578 Share on other sites More sharing options...
studgate Posted August 18, 2007 Author Share Posted August 18, 2007 which script, the comment system or the page that I am trying to integrate it in?? Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327592 Share on other sites More sharing options...
ILYAS415 Posted August 18, 2007 Share Posted August 18, 2007 page ur trying to integrate it in Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327600 Share on other sites More sharing options...
studgate Posted August 18, 2007 Author Share Posted August 18, 2007 I got it to work by using: <?php $page_id = "<?php echo $dataid; ?>"; include("comments/comments_show.php"); include("comments/comments_form.php"); ?> Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327627 Share on other sites More sharing options...
ILYAS415 Posted August 18, 2007 Share Posted August 18, 2007 kk. Link to comment https://forums.phpfreaks.com/topic/65602-solved-sql-query-help-needed/#findComment-327628 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.