Jump to content

Parse error: syntax error, unexpected '$N1' (T_VARIABLE)


Enzy

Recommended Posts

[Help] I can't solve this errorMessage: Parse error: syntax error, unexpected '$N1' (T_VARIABLE), expecting ',' or ';' in /home/u969693299/public_html/sim/core/index.php on line 60<?phpsession_start();if ($_SESSION["nim"]===NULL) {echo "Silahkan untuk login";require "login.html";} else {echo "Selamat datang " . $_SESSION["nim"] . ". Anda berhasil masuk

";$id = $_SESSION["nim"];$DB_NAME = 'u969693299_data';$DB_HOST = 'mysql.##########.com';$DB_USER = 'u969693299_###';$DB_PASS = '######';$con=mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="SELECT nick1,nick9,nick6 FROM `Data` WHERE Nick1='$id'";if ($result=mysqli_query($con,$sql)) { while ($row=mysqli_fetch_row($result)) {echo "Nim : ".$row[0] ."

"; // 42echo "Nama : ".$row[1]."

"; // the email valueecho "blablal : ".$row[2]."

";echo '

 

 

Lihat Nilai SEMESTER: 1 2 3

 

';}$q=$_GET['semester'];if ($q===NULL) {;} else{$sql2="SELECT m1,m2,m3,m4,m5,m6,m7,m8,s1,s2,s3,s4,s5,s6,s7,s8,n1,n2,n3,n4,n5,n6,n7,n8,h1,h2,h3,h4,h5,h6,h7,h8,k1,k2,k3,k4,k5,k6,k7,k8 FROM `Semester1` WHERE NIM1='$id'";if ($result=mysqli_query($con,$sql2)) { while ($row=mysqli_fetch_row($result)) {$m1=$row[0]; $s1=$row[8]; $N1=$row[16]; $h1=$row[24]; $k1=$row[32];$m2=$row[1]; $s2=$row[9]; $N2=$row[17]; $h2=$row[25]; $k2=$row[33];$m3=$row[2]; $s3=$row[10]; $N3=$row[18]; $h3=$row[26]; $k3=$row[34];$m4=$row[3]; $s4=$row[11]; $N4=$row[19]; $h4=$row[27]; $k4=$row[35];$m5=$row[4]; $s5=$row[12]; $N5=$row[20]; $h5=$row[28]; $k5=$row[36];$m6=$row[5]; $s6=$row[13]; $N6=$row[21]; $h6=$row[29]; $k6=$row[37];$m7=$row[6]; $s7=$row[14]; $N7=$row[22]; $h7=$row[30]; $k7=$row[38];$m8=$row[7]; $s8=$row[15]; $N8=$row[23]; $h8=$row[31]; $k8=$row[40];echo "Semester :".$no."";echo "Mata KuliahSKSNILAIHMKeterangan";echo "".$M1."".$S1."."$N1". ".$H1." ".$K1."";echo "".$M2."".$S2."."$N2". ".$H2." ".$K2."";echo "".$M3."".$S3."."$N3". ".$H3." ".$K3."";echo "".$M4."".$S4."."$N4". ".$H4." ".$K4."";echo "".$M5."".$S5."."$N5". ".$H5." ".$K5."";echo "".$M6."".$S6."."$N6". ".$H6." ".$K6."";echo "".$M7."".$S7."."$N7". ".$H7." ".$K7."";echo "".$M8."".$S8."."$N8". ".$H8." ".$K8."";}echo "

";echo "

Keluar"; }}?>

Link to comment
Share on other sites

your code is a mess, and i don't mean because it got posted from wherever you pasted it from without newlines showing in it. your database tables are not designed properly (not normalized), resulting in you needed a bunch of extra php code to manipulate the data (the error is in the bunch of php code you wrote.) also, whoever is teaching you to code is making your life harder than necessary, by not teaching you to use meaningful names for the columns in your database tables or for your php variables or teaching you how to build php strings and echo php variables using the simplest syntax needed.

 

look at the following line of code and see if you don't notice a problem with it - 

echo "".$M1."".$S1."."$N1". ".$H1." ".$K1."";

you have used just about every possible combination of variable, quote, and concatenation dot in that line. i'm guessing you wanted to echo those variables with spaces between each one. all you need to do that is - 

echo "$M1 $S1 $N1 $H1 $K1"; // use the simplest syntax that works
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.