
nicoscodes
Members-
Posts
11 -
Joined
-
Last visited
nicoscodes's Achievements

Newbie (1/5)
0
Reputation
-
Nothing showing, what am I doing wrong here?
nicoscodes replied to nicoscodes's topic in PHP Coding Help
I have spent the last 3 weeks practically going insane. I have pretty much given myself anuerisms and had countless sleepless nights. 3 clients websites have been down and not functional because of this carriage return. You are a fucking god and I want to thank you so much. -
Nothing showing, what am I doing wrong here?
nicoscodes replied to nicoscodes's topic in PHP Coding Help
Running linux, PHP version 5.2.17 error is line 1 where there is no PHP code. -
Nothing showing, what am I doing wrong here?
nicoscodes replied to nicoscodes's topic in PHP Coding Help
The konnect.php file contains database connection (not using PDO): <?php $conn = mysql_connect('localhost', 'user', 'pass') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('data',$conn) or trigger_error("SQL", E_USER_ERROR); mysql_set_charset('utf8',$conn); ?> I have been troube shooting but cannot find where this error is coming from, would it be the host? the host supports PHP5 and I running locally on MAMP with no issues. I appreciate your help and thanks, what is my next course of action is the error log is giving me: Call to undefined function phpinclude() -
Nothing showing, what am I doing wrong here?
nicoscodes replied to nicoscodes's topic in PHP Coding Help
Still coming up blank, nothing showing. In my php error log I am getting: -
Nothing showing, what am I doing wrong here?
nicoscodes replied to nicoscodes's topic in PHP Coding Help
Locally It's working fine. Is there any error in the above code? Is the version of PHP on the server not supproting this? My text editor is saying i have zero synatax errors? -
Hey guys, Nothing is showing up, just getting a blank white page, any suggestions? <?php include("include/konnect.php"); $sql=mysql_query("SELECT * FROM ask"); while($row=mysql_fetch_array($sql)) { $msg=$row['msg']; $mes_id=$row['mes_id']; $up=$row['up']; $down=$row['down']; echo " <div id='main'> <div class='box1'> <div class='up'><a href='' class='vote' id='".$mes_id."' title='Up' name='up'>".$up."</a></div> <div class='down'><a href='' class='vote' id='".$mes_id."' title='Down' name='down'>".$down."</a></div> </div> <div class='box2' > ".$msg." <br><br><div class='fb-comments' data-href='http://example.com/page.php?id=".$mes_id."' data-num-posts='2'></div><br><br> "; } ?>
-
I just didn't think it would be required as it is only the connection, but here is line 1 <?php include("include/conn.php"); ?>
-
Would this require me to change both: if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): As I mentioned I am a begginer, how would i properly execute this fix?
-
No luck there, still getting the PHP Parse error: syntax error, unexpected T_ENDIF error.
-
Hey guys, have a bit of a strange situation going on here. Locally (through mamp) the website loads fine (perfectly actually) and I find zero errors, however going live I face the infamous T_ENDIF error according to my error log. I had the code working remotely however made some changes to only the HTML, uploaded and like as if it was black magic I was faced with the error. I proceeded to trouble shoot and I had the document which was orginally working before I edited the HTML and uploaded that and it worked perfectly, I then took the working document and in my editor hit the space bar, again black magic the working document then gave the same error, I hit cmd+z to undo the spacebar, re-uploaded and still had zero luck. Is it just me or am I going insane? Here is my code: <?php if($post = $_GET["id"]) { echo "<div class='engage-search-result'>Search Result:</div>"; $q = "SELECT * FROM questions WHERE id = '$post'"; $r = mysql_query($q); if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): $net_vote = $row['votes_up'] - $row['votes_down']; ?> <div class='entry'> <div class='q_container'> <div class='left'> <a href='javascript:;' class='vote_up' id='<?php echo $row['id']; ?>'>Up</a> <span class='votes_count' id='votes_count<?php echo $row['id']; ?>'> <?php echo $net_vote.""; ?> </span> <a href='javascript:;' class='vote_down' id='<?php echo $row['id']; ?>'>Down</a> </div><!--// left--> <div class='right'> <span class='link'> <?php echo "<a href='engage.php?id=".$row['id']."'>".$row['question']."</a>"; ?><br><?php echo $row['categorey']; ?> <br><br> <?php echo "<div class='fb-comments' data-href='http://sitehere.com' data-num-posts='2'></div>"; ?> </span><!--// link (span)--> </div><!--// right--> </div><!--// q_container--> </div><!--// entry--> <?php endwhile; endif; ?> <?php } else { $q = "SELECT * FROM questions WHERE verified = 'y'"; $r = mysql_query($q); if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): $net_vote = $row['votes_up'] - $row['votes_down']; ?> <div class='entry'> <div class="q_container"> <div class='left'> <a href='javascript:;' class='vote_up' id='<?php echo $row['id']; ?>'>Up</a> <span class='votes_count' id='votes_count<?php echo $row['id']; ?>'> <?php echo $net_vote.""; ?> </span> <a href='javascript:;' class='vote_down' id='<?php echo $row['id']; ?>'>Down</a> </div><!--// left--> <div class='right'> <span class='link'> <?php echo "<a href='engage.php?id=".$row['id']."'>".$row['question']."</a>"; ?><br>#<?php echo $row['categorey']; ?> </a> <br><br> <?php echo "<div class='fb-comments' data-href='http://www.sitehere.com/engage.php?id=".$row['id']."' data-num-posts='1'></div>"; ?> </span><!--// link (span)--> </div><!--// right--> </div><!--// q_container--> </div><!--// entry--> <?php endwhile; endif; } ?> I call my DB connection at the top of the browser using include, the error log shows the error on line 1 where my DB connection is held. I am only a begginer with PHP and I am aware I am not using PDO. Any help would be greatly appreciated.
-
Hey guys! First time post here and I am only a begginer in programming. Anyway I have a few questions as I am stuck and have been for quite a while. I know this is a long post but it will cover the whole entire process of what I am doing at the moment. I really appreciate the time anyone can give me and will be happy to paypal someone over some $ for any help they can give me. Firstly, I am working with a bit of javascript and PHP. I am using a javascript method to update content from my table data in mysql without reloading the page. It works very well but I want to simplify the way i do things with the javascript so I am not left with repetative lines of code. Here is my javascript: $(document).ready(function() { //Edit link action (1) $('.edit_link').click(function(){$('.text_wrapper').hide(); var data=$('.text_wrapper').html(); $('.edit').show();$('.editbox').html(data);$('.editbox').focus();}); //Edit link action (2) $('.edit_link2').click(function(){$('.text_wrapper2').hide(); var data=$('.text_wrapper2').html();$('.edit2').show(); $('.editbox2').html(data);$('.editbox2').focus();}); //Mouseup textarea false (1) $(".editbox").mouseup(function(){return false}); //Mouseup textarea false (2) $(".editbox2").mouseup(function(){return false}); //Textarea content editing (1) $(".editbox").change(function(){$('.edit').hide();var boxval = $(".editbox").val(); var dataString = 'data='+ boxval;$.ajax({type: "POST",url: "update.php",data: dataString,cache: false,success: function(html){$('.text_wrapper').html(boxval);$('.text_wrapper').show();}});}); //Textarea content editing (2) $(".editbox2").change(function(){$('.edit2').hide(); var boxval = $(".editbox2").val();var dataString = 'data2='+ boxval;$.ajax({type: "POST",url: "update.php",data: dataString,cache: false,success: function(html){$('.text_wrapper2').html(boxval);$('.text_wrapper2').show();}});}); //Textarea without editing (1) $(document).mouseup(function(){$('.edit').hide();$('.text_wrapper').show();}); //Textarea without editing (2) $(document).mouseup(function(){$('.edit2').hide();$('.text_wrapper2').show();}); }); As you can see I am having to repeat the functions and all I do is change the name. Instead of repeating the script like I am over and over again to recognise different textareas is there a way I can array it or something like this so I don't have endless lines of the same code over and over again? I have allot more then just 2 textareas but of course shortened it for this post. Here is how I UPDATE the data in MySQL. I am looking into moving this over to PDO as I have be learning that PDO is the more safe and finctional option. My question here would be is there a simple way to UPDATE the rows instead of the way I doing this by repeating this process over and over again? I know I can use the: if (isset()); but I am troubled to work out how I would define the "id" of the data I am changing? <?php include("connection.php"); if($_POST['data']) { $data=$_POST['data']; $data = mysql_escape_String($data); $sql = "update slider set content='$data' where id='1'"; mysql_query( $sql); } if($_POST['data2']) { $data2=$_POST['data2']; $data2 = mysql_escape_String($data2); $sql = "update slider set content='$data2' where id='2'"; mysql_query( $sql); } ?> The HTML is quite simple. The form is wrapped in a div and the "edit" link is defined by class which again I repeat by just copy and past, the select is done via "id" which I need to define in the UPDATE section: <a href="#" class="edit_link" title="Edit">Edit</a> <? $sql=mysql_query("select content from slider where id='1'"); $row=mysql_fetch_array($sql); $profile=$row['content']; ?> <div class="text_wrapper" style=""><?php echo $profile; ?></div> <div class="edit" style="display:none"> <textarea class="editbox" cols="23" rows="3" name="profile_box"></textarea> </div> <a href="#" class="edit_link2" title="Edit">Edit</a> <? $sql=mysql_query("select content from slider where id='2'"); $row=mysql_fetch_array($sql); $profile=$row['content']; ?> <div class="text_wrapper2" style=""><?php echo $profile; ?></div> <div class="edit2" style="display:none"> <textarea class="editbox2" cols="23" rows="3" name="profile_box"></textarea> </div> I hate asking for help but I really need some guidence here as myself and Javascript are not good friends and myself and PHP are just starting a relationship, if you know what I mean. Any examples of how to achieve this? I do beleive if anyone could put me in the right direction it would be a great script to share around as it is very functional. I apologize for such a large post, however I really am stuck and have gone this far. I have researched google but find i just keep getting stuck. Idealy I just want to simplify the whole script, make it more functional and save myself the repetative task of going over the same thing again and again.