473,788 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Quick Syntax Question:

40 New Member
Hi all, I have a really quick syntax problem I can't seem to hammer out...

In my script, I am trying to set a variable based upon an entry from my SQL table. Here's two different lines of code I've tried, but neither of them seems to work:

Expand|Select|Wrap|Line Numbers
  1. var opt_a = ($_POST['<?php echo $row_rs_detail['option_a']; ?>']);
This isn't working, but I don't get an error...

[PHP]var opt_a = <?php echo "$_POST[".$row_rs_detai l['option_a']."]"; ?>;[/PHP]

This isn't working AND gives me an error.

I apologize in advance for being a javascript and php newbie... maybe I'm going about this the wrong way. Any suggestions?

Thanks in advance.
Nov 12 '07 #1
2 1215
code green
1,726 Recognized Expert Top Contributor
This isn't working AND gives me an error.
What do you mean by 'isn't working' and what is the error?
What values do the variables contain?
Nov 13 '07 #2
mwasif
802 Recognized Expert Contributor
This should fix your problem if $row_rs_detail is a resultset.
[PHP]var opt_a = <?php echo $row_rs_detail['option_a']; ?>;[/PHP]
Why you are using $_POST?
Nov 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
1734
by: Christopher Benson-Manica | last post by:
If you had an unsigned int that needed to be cast to a const myClass*, would you use const myClass* a=reinterpret_cast<const myClass*>(my_val); or const myClass* a=(const myClass*)myVal; ?
8
1225
by: Menon | last post by:
Hi folks I am not at all an SQL server guy (more of an Oracle developer.) I wanted to know if you guys could tell me if SQL Server supports objects in the database. If so, could you kindly point me to a doc or a very quick overview of main object features? Many thanx!
14
1654
by: PengYu.UT | last post by:
Hi, I have been using C++ a lot and I've almost forgot what syntax is support by C and what syntax is support by C++? My feeling is that C++ gives programmer much flexibility. And the code is more localized in C++ than C, which mean changes won't propogate far away in C++ code. By reusing through inherence and overloading, a lot of code can be saved. But I have to use C for some reason. Is there any programming paradigm in C, which...
8
1259
by: Phil Latio | last post by:
What is the technical name or the name most commonly used for the below? United Kingdom >Wiltshire >Trowbridge Basically you have a table like: category_id, parent_category_id, category_name Sure it has name from a fairy tale but for the life of me I can't remember. I keep thinking daisy chaining but I know it's not. Is it something from Hansel and Gretal?
4
341
by: learning_codes | last post by:
Hi, What is the difference between Visual Basic and Access XP VBA? Thanks
5
1002
by: Robocop | last post by:
Is it possible to do something like this syntactically: year = '2008' month = '09' limit = '31' for i in range(1,limit): temp = Table.objects.filter(date = year'-'month'-'i) <----screwed up syntax ...do something with temp return
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.