output value LS database

More
4 years 10 months ago #102536 by RoMaier
RoMaier created the topic: output value LS database
Hey,

I hope you can help me, I'm already despair :( How can I access the LS database, and let me spend a value with a script?
I tried it this way:

<?php
session_start();
include "mysql_ls.php"; //the conection to database works!//

...

$query = "SELECT 71744X7X30 FROM lime_survey_71744 WHERE id = $id";
$result = mysql_query($query);
if (!$result) {include ("error.php"); die("DATABASE ERROR: ".mysql_error());}
while($row = mysql_fetch_object($result))
{$byear = $row->71744X3X30;}

?>


But the problem is that PHP not accepted the SGQA on the line "{$byear = $row->71744X3X30;}". I think because the variable name starts with a number.
Alternatively, the idea was to pass the required variables into a new database and rename it, such as:

End_URL:
http://localhost/experiencetime/experiencetime/experiencetime_validate.php?user={SAVEDID}&byear={INSERTANS:71744X7X30}&bf1={INSERTANS:71744X8X41SQ001}&bf2={INSERTANS:71744X8X41SQ002}&bf3={INSERTANS:71744X8X41SQ003}&bf4={INSERTANS:71744X8X41SQ004}&bf5={INSERTANS:71744X8X41SQ005}&bf6={INSERTANS:71744X8X41SQ006}&bf7={INSERTANS:71744X8X41SQ007}&bf8={INSERTANS:71744X8X41SQ008}&bf9={INSERTANS:71744X8X41SQ009}&bf10={INSERTANS:71744X8X41SQ010}&bf11={INSERTANS:71744X8X41SQ011}&bf12={INSERTANS:71744X8X41SQ012}&bf13={INSERTANS:71744X8X41SQ013}&bf14={INSERTANS:71744X8X41SQ014}&bf15={INSERTANS:71744X8X41SQ015}&prepared1={INSERTANS:71744X22X90SQ001}&prepared2={INSERTANS:71744X22X90SQ002}&prepared3={INSERTANS:71744X22X90SQ003}&prepared4={INSERTANS:71744X22X90SQ004}&prepared5={INSERTANS:71744X22X90SQ005}&prepared6={INSERTANS:71744X22X90SQ006}&prepared7={INSERTANS:71744X22X90SQ007}&prepared8={INSERTANS:71744X22X90SQ008}&prepared9={INSERTANS:71744X22X90SQ009}&prepared10={INSERTANS:71744X22X90SQ010}&prepared11={INSERTANS:71744X22X90SQ011}&prepared12={INSERTANS:71744X22X90SQ012}&prepared13={INSERTANS:71744X22X90SQ013}&prepared14={INSERTANS:71744X22X90SQ014}&prepared15={INSERTANS:71744X22X90SQ015}

However, I can only pass 4 variables at the end URL, but consumes 32 variables. Can I extend the End_URL field? Or can I output values in any other way?

Many Thanks!
Ronja

Please Log in or Create an account to join the conversation.

More
4 years 10 months ago - 4 years 10 months ago #102648 by Marksom
Marksom replied the topic: output value LS database
For me PHP usually accept a call to the mysql database.
PHP 5.4
mysql 5.5.2
$name='71744X3X30';
$code='71744';
 
mysql_select_db($db, $show);	
$query = "SELECT $name FROM lime_survey_$code";
$result = mysql_query($query, $show) or die(mysql_error());

Can your PHP version, but try to turn it into a first variable.
Hope this helps
Last Edit: 4 years 10 months ago by Marksom.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!