Jump to content

Recommended Posts

for some reason, I'm receiving a T_VARIABLE error with the following code on line 20

 

<?php

include 'connect.php';

// Extracting Data
$sql = "SELECT css_file, js_file, div_file, table_file
	FROM stageone
	WHERE id = '1'";
$result = mysql_query ($sql) or die (mysql_error());
list ($css_num, $js_num, $div_num, $table_num) = mysql_fetch_row($result); 

$int_val1 = 0;
$int_val2 = 0;
$int_val3 = 0;
$int_val4 = 0;

// create css variables
do
{
$css_file$int_val1 = $_POST["css_name$int_val1"];
echo "<link rel='stylesheet' href='$css_file$int_val1' type='text/css'>\n";

$int_val1++;
}
while ($int_val1 != $css_num);	

// create js variables
do
{
$js_file$int_val2 = $_POST["js_name$int_val2"];
echo "<script language='JavaScript' src='$js_file$int_val2' type='text/javascript'></script>\n";

$int_val2++;
}
while ($int_val2 != $js_num);	

?>

Link to comment
https://forums.phpfreaks.com/topic/106170-t_variable-error/
Share on other sites

for some reason, I'm receiving a T_VARIABLE error with the following code on line 20

 

<?php

include 'connect.php';

// Extracting Data
$sql = "SELECT css_file, js_file, div_file, table_file
	FROM stageone
	WHERE id = '1'";
$result = mysql_query ($sql) or die (mysql_error());
list ($css_num, $js_num, $div_num, $table_num) = mysql_fetch_row($result); 

$int_val1 = 0;
$int_val2 = 0;
$int_val3 = 0;
$int_val4 = 0;

// create css variables
do
{
$css_file$int_val1 = $_POST["css_name$int_val1"];
echo "<link rel='stylesheet' href='$css_file$int_val1' type='text/css'>\n";

$int_val1++;
}
while ($int_val1 != $css_num);	

// create js variables
do
{
$js_file$int_val2 = $_POST["js_name$int_val2"];
echo "<script language='JavaScript' src='$js_file$int_val2' type='text/javascript'></script>\n";

$int_val2++;
}
while ($int_val2 != $js_num);	

?>

 

When you have 2 variables together as you do on two occasions ($sj_file$int_val2), put a . in between them.

Link to comment
https://forums.phpfreaks.com/topic/106170-t_variable-error/#findComment-544201
Share on other sites

change

do
{
$css_file$int_val1 = $_POST["css_name$int_val1"];
echo "<link rel='stylesheet' href='$css_file$int_val1' type='text/css'>\n";

$int_val1++;
}
while ($int_val1 != $css_num);	

to

do
{
$css_file = $_POST["css_name$int_val1"];
echo "<link rel='stylesheet' href='$css_file' type='text/css'>\n";

$int_val1++;
}
while ($int_val1 != $css_num);	

Link to comment
https://forums.phpfreaks.com/topic/106170-t_variable-error/#findComment-544218
Share on other sites

here you go

 

<?php

include 'connect.php';

// Extracting Data
$sql = "SELECT css_file, js_file, div_file, table_file
	FROM stageone
	WHERE id = '1'";
$result = mysql_query ($sql) or die (mysql_error());
list ($css_num, $js_num, $div_num, $table_num) = mysql_fetch_row($result); 

$int_val1 = 0;
$int_val2 = 0;
$int_val3 = 0;
$int_val4 = 0;

// create css variables


do
{
$css_file.$int_val1 = $_POST["css_name$int_val1"];
echo "<link rel='stylesheet' href='$css_file$int_val1' type='text/css'>\n";

$int_val1++;
}
while ($int_val1 != $css_num);	

// create js variables
do
{
$js_file.$int_val2 = $_POST["js_name$int_val2"];
echo "<script language='JavaScript' src='$js_file$int_val2' type='text/javascript'></script>\n";

$int_val2++;
}
while ($int_val2 != $js_num);	

?>

Link to comment
https://forums.phpfreaks.com/topic/106170-t_variable-error/#findComment-544231
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.